Написание калькулятора с разбором выражений, страница 4

        return true;

      case ')':

        RisePriority -= 1000;

        FTC_Position++;

        return true;

 /*     case 's':

      case 'S':

        if (FunctionCall ('s'))

        {

          PriorityBuf.PUSH (500 + RisePriority);

          FTC_Position += 3;

          LastPriority = GetLastPriority ();

          return true;

        }

      case 'c':

      case 'C':

        if (FunctionCall ('c'))

        {

          PriorityBuf.PUSH (501 + RisePriority);

          FTC_Position += 3;

          LastPriority = GetLastPriority ();*/

      default:

        if (p = FunctionCall (FTC[FTC_Position]))

        {

          PriorityBuf.PUSH (p - 100 + RisePriority);

          switch (p)

          {

          case 600:

          case 601:

          case 604:

          case 605:

            FTC_Position += 3;

            break;

          case 602:

          case 603:

          case 606:

          case 607:

            FTC_Position += 4;

            break;

          }

          return true;

        }

      }

      PriorityBuf.PUSH (SetPriority (FTC[FTC_Position++]) + RisePriority);

      return true;

    }

    /* END OF 'PUSH_Priority' FUNCTION */

    /* THIS OVERRIDEN FUNCTION PUSH PRIORITY TO PRIORITY BUFFER */

    bool PUSH_Priority (int prt)// OverWritten function

    {

      PriorityBuf.PUSH (prt);

      LastPriority = GetLastPriority ();

      return true;

    }

    /* END OF OVERRIDEN FUNCTION */

    /* THIS FUNCTION PUSH NUMBER TO NUMBER BUFFER */

    bool PUSH_Number (void)

    {

      long double NUMBER = GetNumber ();

      NumberBuf.PUSH (NUMBER);

      return true;

    }

    /* END OF 'PUSH_Number' FUNTION */

    /* THIS OVERRIDE FUNCTION PUSH NUMBER TO NUMBER BUFER */

    bool PUSH_Number (long double NUMBER)

    {

      NumberBuf.PUSH (NUMBER);

      return true;

    }

    /* END OF OVERRIDEN FUNCTION */

    /* THIS FUNCTION POP PRIRITY ELEMENT FROM PRIORITY BUFFER */

    int POP_Priority (void)

    {

      int prt = -0xFF;

      if (PriorityBuf.TOP () == 0)

        return prt;

      prt = PriorityBuf.POP ();

      LastPriority = GetLastPriority ();

      return prt;

    }

    /* END OF 'POP_Priority' FUNCTION */

    /* THIS FUNCTION POP NUMBER FROM NUMBER BUFFER */

    bool POP_Number (long double *num)

    {

      if (NumberBuf.TOP () == 0)

        return false;

      *num = NumberBuf.POP ();

      return true;

    }

    /* END OF 'POP_Number' FUNCTION */

  /* END OF DOUBLE STACK FUNCTIONS PUSH AND POP DEFINITIONS */

    /* THIS FUNCTION CALCULATE BUFFER */

    void CalcBuf (int prt)

    {

      long double num_1 = 0, num_2 = 0;

      switch (prt % 1000)

      {

      case 506:

        POP_Number (&num_1);

        num_1 = atan (num_1);

        PUSH_Number (num_1);

        break;

      case 505:

        POP_Number (&num_1);

        num_1 = 1 / tan (num_1);

        PUSH_Number (num_1);

        break;

      case 504:

        POP_Number (&num_1);

        num_1 = tan (num_1);

        PUSH_Number (num_1);

        break;

      case 503:

        POP_Number (&num_1);

        num_1 = acos (num_1);