You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "Andrew C. Oliver" <ac...@apache.org> on 2003/01/24 10:33:49 UTC

Re: IF Formulas and the ',' delimiter

The problem is that the Formula parser is suffering from a leaky 
abstraction or more accurately my inaccurate assumption that 1 token -> 
one PTG and the such.  Here is my insight as to how to correct the problem

http://nagoya.apache.org/wiki/apachewiki.cgi?RefactorAndCompleteFormulaParsing

-Andy

Riley, Cameron wrote:

>The IF formulas in HSSF currently dont write to the "," components of a
>formula. A Formula that is set as "IF(A1>8,12,11)" is written by HSSF as
>"(A1>8 12 11)". The bytes from an xls file for the sequence after the A1
>are;
>
>15 1E 08 00 0D 19 02 07 00 1E 0C 00 19 08 0A 00 1E 0B 00 19 08 03
>
>The where the third byte is 08 is 8 in the formula, 0D is the > and  0C is
>12 and 0B is 11. The sequence to the 12 is;
>
>  19 02 07 00 1E 0C 00 
> 
>where 07 appears to be the length and 1E the token identifier 00 0C or 12.
>The sequence to 11 is;
>
>  19 08 0A 00 1E 0B 00 19 08 03
>
>where 0A appears to be the length and 1E the token identifier for 00 OB or
>11. There are two sequences though;
>
>  19 02 for the first comma 
>  19 08 for the second comma 
>  19 08 to end the IF statement. 
>
>If anyone has mroe insight into how the ',' in an IF statement work I would
>be interested.
>
>
>
>Cameron Riley 
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>




Re: IF Formulas and the ',' delimiter

Posted by Avik Sengupta <av...@itellix.com>.
comma's are actually never written for function arguments. IF is just
another function with arguments. Its infix, so each function ptg takes
the number of operands it needs from stack. 

Further, there are two kinds of functions, fixed number of args, and
variable number of args. Functions with variable args have the number of
args encoded into the ptg array. I dont atm remember what kind IF is. 

thats the general overview.. if you need more specifc stuff, just shout.
regards
-
Avik


On Fri, 2003-01-24 at 15:03, Andrew C. Oliver wrote:
> The problem is that the Formula parser is suffering from a leaky 
> abstraction or more accurately my inaccurate assumption that 1 token -> 
> one PTG and the such.  Here is my insight as to how to correct the problem
> 
> http://nagoya.apache.org/wiki/apachewiki.cgi?RefactorAndCompleteFormulaParsing
> 
> -Andy
> 
> Riley, Cameron wrote:
> 
> >The IF formulas in HSSF currently dont write to the "," components of a
> >formula. A Formula that is set as "IF(A1>8,12,11)" is written by HSSF as
> >"(A1>8 12 11)". The bytes from an xls file for the sequence after the A1
> >are;
> >
> >15 1E 08 00 0D 19 02 07 00 1E 0C 00 19 08 0A 00 1E 0B 00 19 08 03
> >
> >The where the third byte is 08 is 8 in the formula, 0D is the > and  0C is
> >12 and 0B is 11. The sequence to the 12 is;
> >
> >  19 02 07 00 1E 0C 00 
> > 
> >where 07 appears to be the length and 1E the token identifier 00 0C or 12.
> >The sequence to 11 is;
> >
> >  19 08 0A 00 1E 0B 00 19 08 03
> >
> >where 0A appears to be the length and 1E the token identifier for 00 OB or
> >11. There are two sequences though;
> >
> >  19 02 for the first comma 
> >  19 08 for the second comma 
> >  19 08 to end the IF statement. 
> >
> >If anyone has mroe insight into how the ',' in an IF statement work I would
> >be interested.
> >
> >
> >
> >Cameron Riley 
> >
> >
> >--
> >To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> >For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
> >
> >  
> >
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>