Example #1
0
int dfs(int x, char s)
{
    int y;
    while(1)
    {
        if(c[now] == '(')
        {
            now++;
            y = dfs(0, '+');
            now++;
        }
        else y = getint();
        while(1)
        {
            char nexts = c[now++];
            if(getstep(nexts) < getstep(s))
            {
                now--;
                return calc(x, s, y);
            }
            else if(getstep(nexts) > getstep(s) || (s == nexts && s == '^'))
            {    
                y = dfs(y, nexts);
            }
            else 
            {
                x = calc(x, s, y);
                s = nexts;
                break;
            }
        }
    }
}
Example #2
0
/*--------------------------------------------------------------------*\
 | FUNCTION     : getstep_
 | COMMENT		:
 | PARAMETERS   :
 | RETURN VALUE : 
 | RESTRICTIONS :
\*--------------------------------------------------------------------*/
long getstep_ (void) {
  return getstep();
}