//#include "Unix.h"
#include "stdafx.h"   //MS Windows
#include "Strawberry.h"

#include "string.h"
#include "MainFrm.h"
#include "StrawberryDoc.h"
#include "Dialog.h"

DWORD read_n(DWORD *ter, DWORD FromW) // FromW  0 - read window, 1 - from file
                                      //        2 - given,       3 - pActiveFile
                                      //                         5 - CArchive
                                      //  8 - clause (not in Buda)
                                      // 16 - Syntax Coloring
                                      // 32 - don't print in output
{
  DWORD array_br, ar_br2, k, kl, kll, i, j, t, tt, coment_br, err_code, Type, a, b;
  DWORD ReSt_br, atom_br, AddInfo_br, AddInfo_br2, buf_br;
// ArType 119 op, 120 ,| 121(, 124 (, 125 {, 126 [, 256 atom, 257 'atom', 258 symbols atom, 
//        127 var, 128 G_var, 129 string, 130 num, 131 float, 132 obj
  DWORD file_end=0, flush_fl, j1=0, j2=0, color1=LAST_COLOR;
  // the next is static because it is constant
  static char color_string[LAST_COLOR][7]= {"\\cf1 ","\\cf2 ","\\cf3 ","\\cf4 ","\\cf5 ",
    "\\cf6 ","\\cf7 ","\\cf8 ","\\cf9 ","\\cf10 ","\\cf11 ","\\cf12 ","\\cf13 ","\\cf14 "};
again:
  array_br=ar_br2=1; k=127; kl=Type=ReSt_br=atom_br=AddInfo_br=AddInfo_br2=buf_br=0;
  list_br=0;
  for(; 1; i_poin++)
  {
    if (string[i_poin]==0)
    {
      if (file_end) // empty but not starting
      {
        if (Type || array_br>1)
          Warning(57, FromW, 0, 0);    // Error! Unexpected end of file
#if !CONSOLE
        if (FromW&16)
        {
          i_poin--;
          flush_fl=1;
          goto s_color;
        }
#endif // !CONSOLE
        f_end=0;
        return(0);
      }
#if !CONSOLE
      if (FromW&16)
      { 
        if (j1>0)
        {
flush2:   for (i=j1; i<=f_end; i++)  // f_end==L_BUFER in a normal situation
            string[i-j1]=string[i];
          j2-=j1;
          i_poin=f_end-j1;
          j1=0;  
        }
        else if (f_end>=L_BUFER) // flush
        {
          flush_fl=2;
          goto s_color;
        }
      }
      else
#endif // !CONSOLE
        i_poin=0;
flush:switch (FromW&7)
      {
       case 0:
#if CONSOLE
        read_br+=f_end;
        if (gl_read&1)
        {
          string[0]='"';
          string[1]=0;
          fgets(string+1, L_BUFER-2, stdin);
          strcat(string, "\"");
        }
        else
        {
          string[0]=0;
          fgets(string, L_BUFER, stdin);
        }
        strcat(string, " . ");
        f_end=strlen(string)+1;
#else
        {
        CWnd* pWinTemp=(pMain_Frame)?(CWnd*)pMain_Frame:(CWnd*)pMainFrame;
        CdRead readDlg(pWinTemp);
        if (readDlg.DoModal()!=IDOK || f_end==0)
          return(2); // Cancel
        strcat(string, " . ");
        f_end+=3; 
        }
#endif // CONSOLE
        break;
       case 1:
        read_br+=f_end;
#if CONSOLE
        f_end=read(file, string, L_BUFER);
#else
        f_end=file.Read(string, L_BUFER);
#endif
        break;
       case 2:
        return(0);
#if !CONSOLE
       case 3:
        read_br+=f_end-i_poin;
        f_end=pGFile->Read(string+i_poin, L_BUFER-i_poin)+i_poin;
        //CStringA ret_string;
        //CRichEditCtrl *pEdit=&(pActiveFile->GetView()->GetRichEditCtrl());
        //read_br+=f_end-i_poin;
        //f_end=pEdit->GetTextRange(read_br+i_poin, read_br+L_BUFER, ret_string)+i_poin;
        //strcpy(string+i_poin, ret_string);
        break;
       case 5:
        read_br+=f_end-i_poin;
        f_end=pAr->Read(string+i_poin, L_BUFER-i_poin)+i_poin;
#endif // !CONSOLE
      }
      string[f_end]=0;
      if (f_end==i_poin)
      {
        if (!(FromW&1))  // 0 or 2
          return(0);
        else
        {
          string[f_end+1]=0;     // we need 129 after full stop OR when unexpected end of file
          file_end=1;
        }  
      }
    }
    kl=key_map[(BYTE)(string[i_poin])];
    if(kl==128 && Type!=4 && Type!=5) /* noting */
      continue;
    if(kl==130 && !(FromW&16))
      newline_br++;
    i=kl; kl=k; k=i;
    switch (Type)
    {
     case 0:   // somting new
R4:   if (k==129 || k==130)                // space or enter
        continue;
      else if (k<80 || (83<k && k<123))    // letter
      {
        if (k<10)            // digit
        {
          Type=k?13:10;
          atom_buf[0]=string[i_poin];
          atom_br=1;
        }
        else
        {
          atom_buf[0]=(BYTE)k;
          atom_br=1;
          if (62<k && k<80)            // symbol
            Type=2;
          else  
            Type=1;
        }
      }
      else if (k<84)                    // ! ; , |
      {
        Array[array_br]=k;
        if (k<82)
        {
          Type=12;
          continue;
        }
        ArPos[array_br]=i_poin+read_br-newline_br+1; // SyntColor
        ArType[array_br++]=120; 
      }
      else if (k<137)                    // bracket
      {
        if (k&1)    // open
        {
          ArPos[array_br]=i_poin+read_br-newline_br+1; // SyntColor
          ArType[array_br]=k/2+59;        // 131 -> 124
          ReadStack[ReSt_br++]=array_br++;
        }
        else if (ReSt_br && ((i=ArType[ReadStack[ReSt_br-1]])==k/2+58 // 132 -> 124
                    || i==k/2+55))        // 132 -> 121
        {
          ReSt_br--;
          AddInfo[AddInfo_br++]=i_poin+read_br-newline_br+1; // SyntColor
          if (!(Array[ReadStack[ReSt_br]]=array_br-ReadStack[ReSt_br]-1)
                        && ArType[array_br-1]==124)
          {
            err_code=6;    // You wrote () without function
            goto err;
          }
        }
        else
        {
          err_code=k/2-64;    // Unexpected )}]  132 -> 2 (TT_OBJ)
          goto err;
        }
      }
      else if (k<140)                    // ' " `
      {
        atom_br=0;
        if (k==137)            // 'Atom'
          Type=3;
        else if (k==138)    // "string"
          Type=4;
        else                // `string`
          Type=5;
        k=127;
      }
      else if (k==140)                    // %
        Type=9;
      else
        MitiText("System error: Unknown Symbol.\r\n");
      continue;
     case 1:   // continue of var or atom
R11:  if(k<63 || (83<k && k<123))        // digit or letter
        atom_buf[atom_br++]=(BYTE)k;
      else
      {
        if (atom_br>2 && atom_buf[0]==16 && atom_buf[1]==36) // G_x, i.e. global var
        {  
#if !CONSOLE
          if (FromW&16)
            i=0;
          else
          {
#endif
          for (i=atom_br-3, t=atom_buf[i+2]; i-->0 ;)
            t=creat_p(2, atom_buf[i+2], t, 1 ,1);
          for (i=0; i<global_br2 && global[i]!=t ; i++);
          if (i==global_br2) // New global var
          {
            if (global_br2>=GLOBAL_max && correct_GLOB_max())
            {
              MessageBoxA(NUL, "Too many global variables!", "No Space", MB_OK | MB_ICONSTOP);
              return (0);
            }
            global[global_br2++]=t;
            if (!(FromW&8))
            {
              if (BUDA3_UP<=buda_br_up++ && correct_BUDA_UP() )
              {
                MessageBoxA(NUL,"Variables Store is Full!", "No Space", MB_OK | MB_ICONSTOP);
                return (0);
              }
              Buda1[-buda_br_up]=TT_VAR;

              Link[-buda_br_up]= i;
              Buda1[buda_br+list_br]=TT_LINK;
              Buda2[buda_br+list_br]=Array[array_br]=global2[i]= -buda_br_up;
              WILL_CLEAN(buda_br+list_br);
            }
            else
            {
              global2[i]=1; // for worning
              Array[array_br]=i;
            }
          }
          else if (!(FromW&8))
          {
            Buda1[buda_br+list_br]=TT_LINK;
            Buda2[buda_br+list_br]=Array[array_br]=global2[i];
            WILL_CLEAN(buda_br+list_br);
          }
          else
          {
            global2[i]++; // for worning
            Array[array_br]=i;
          }
#if !CONSOLE
          }
#endif
          ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
          ArType[array_br]=128;
          Left[array_br++]=list_br;
          list[list_br]=list_br?list[list_br-1]:0;  // '_' var
          list_br++;
          goto R3;
        }
        if ((9<atom_buf[0] && atom_buf[0]<37) ||
             (83<atom_buf[0] && atom_buf[0]<102) )    /* variable */
        {
          if (atom_buf[0]==36 && atom_br==1)       // _ - unnamed variable
          {
            i=list_br;
            if (!(FromW&8))
              Buda1[buda_br+list_br]=TT_VAR;
            list[list_br]=list_br?list[list_br-1]:0;  // '_' var
            list_br++;
          }  
          else
          {  
            DWORD n;
            for (i=t=0; i<list_br; t=list[i++])
              if (list[i]-t==atom_br)
              {
                for (n=0; n<atom_br && atom_buf[n]==var_field[t+n]; n++);
                if (n==atom_br)
                  goto e_found;
              }    
            if (!(FromW&8))
              Buda1[buda_br+list_br]=TT_VAR;
            list[list_br++]=t+atom_br;
            for (n=0; n<atom_br; var_field[t+n]=atom_buf[n], n++);
          }
e_found:  ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
          ArType[array_br]=127;
          Array[array_br++]=i;
        }
        else
        {
          for (i=atom_br-1, t=atom_buf[i]; i-->0 ;)
            t=creat_p(2, atom_buf[i], t, 1 ,1);
          Array[array_br]=t;
          ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
          ArType[array_br++]=256;  // has right to be an oparator
        }
R3:     Type=0;
        if (k==131)     // glued([{ || ***k==133 || k==135
        {
          ArPos[array_br]=i_poin+read_br-newline_br+1; // SyntColor
          ArType[array_br]=121;        // 131 -> 121 ***k/2+56
          ReadStack[ReSt_br++]=array_br++;
        }
        else
          goto R4;
      }
      continue;
     case 2:   // continue of symbol atom
R12:  if (62<k && k<80)       // symbol
      {
        if (k==71 && atom_buf[atom_br-1]==74) // start of comment
        {
          if (atom_br==1)
          {
            coment_br=0;
            Type=6;
            continue;
          }
          Warning(1, FromW, 0, 0);       //  /* in symbol atom
        }
        atom_buf[atom_br++]=(BYTE)k;
        continue;
      }
      else if (atom_buf[atom_br-1]==67)    // full stop  '.'
      {
        if (k==129 || k==130)  // space after full stop
        {
          if (ReSt_br==0)
          {
            if (atom_br==1) // end of first part
            {
              if (k==130 && !(FromW&16))
                newline_br--;
              goto R2;
            }
            else 
              Warning(2, FromW, 0, 0);    // possibly glued full stop
          }
          else if (atom_br==1)
          {
            err_code=1;  // Unexpected full stop
            goto err;
          }
        }
      }
      for (i=atom_br-1, t=atom_buf[i]; i-->0 ;)
        t=creat_p(2, atom_buf[i], t, 1 ,1);
      Array[array_br]=t;
     case 12:
      ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
      ArType[array_br++]=258;  // has to be an oparator
      goto R3;
     case 3:            // 'Atom'
      if (kl==127)        // first
        continue;
      if (kl==137)
      {
        if (!atom_br)        // empty
        {
          err_code=5;        //  you can not write empty atoms
          goto err;
        }
#if !CONSOLE
        if (FromW&16)
          t=0;
        else
#endif
          for (i=atom_br-1, t=atom_buf[i]; i-->0 ;)
            t=creat_p(2, atom_buf[i], t, 1 ,1);
        ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
        ArType[array_br]=257;  // has no right to be an oparator
        Array[array_br++]=t;
        goto R3;
      }
      else if (kl>126)
        Warning(3, FromW, 0, 0);        // symbol cannot be in an atom
      else
        atom_buf[atom_br++]=(BYTE)kl;
      continue;
     case 4:            // "String"
     case 5:
      if (kl==134+Type)       // " or `
      {
        for (i=atom_br; i>2 && atom_buf[i-2]=='\\' && atom_buf[i-3]=='\\'; i-=2);
        if (i>1 && atom_buf[i-2]=='\\')   // \"  \`
        {
          atom_buf[atom_br-2]=(Type==4)?'\"':'`';
          atom_buf[atom_br-1]=string[i_poin];
        }
        else if (k==134+Type)  // ""
          k=127;
        else
        {
          ArType[array_br]=129;
          if (atom_br==1)         // empty
          {
            Array[array_br]=0;
            goto R13;
          }
          Array[array_br]=j=sv_StStore;
          if ((sv_StStore+=atom_br)>=STRING_STORE && correct_STR_ST() )
          {
            MessageBoxA(NUL, "The string store is full.", "No Space", MB_OK | MB_ICONSTOP);
            return (0);
          }
          for (i=0; i<atom_br-1; )
            if (atom_buf[i]=='\\')
            {
              if (atom_buf[i+1]=='\\' || atom_buf[i+1]=='`' || atom_buf[i+1]=='\"')
              {
                StringStore[j++]=atom_buf[i+1];
                i+=2;
              }
              else if (atom_buf[i+1]=='\n')
                i+=2;
#if !CONCOLE
              else if (atom_buf[i+1]=='\r')
                i+=3;
#endif
              else if (atom_buf[i+1]=='0')
              {
                StringStore[j++]='\\';
                StringStore[j++]='0';
                i+=2;
              }
              else if (atom_buf[i+1]=='n')
              {
                StringStore[j++]='\n';
                i+=2;
              }
              else if (atom_buf[i+1]=='t')
              {
                StringStore[j++]='\t';
                i+=2;
              }
              else if (atom_buf[i+1]=='r')
              {
                StringStore[j++]='\r';
                i+=2;
              }
              else
              {
                err_code=14;    // The symbol \ has to be replaced
                goto err;
              }
            }
            else if (atom_buf[i]=='\r')
              i++;
            else
              StringStore[j++]=atom_buf[i++];
          StringStore[j]=0;
          sv_StStore=j+1;
R13:      ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
          Left[array_br++]=list_br;
          list[list_br]=list_br?list[list_br-1]:0;  // '_' var
          list_br++;
          if (k==128)
          {
            Type=0;
            continue;
          }
          goto R3;
        }
      }
      else
        atom_buf[atom_br++]=string[i_poin];
      continue;
     case 6:   // normal comment
      if (k==71)    // *
        Type=7;
      else if (k==74) // '/' (nested comments)
        Type=8;
      continue;
     case 7:       // comment *
      if (k==74)   // '/' i.e. end
      {
        if (coment_br==0)
        {
          AddInfo[AddInfo_br++]=HALF|(i_poin+read_br-newline_br+1); // SyntColor
          Type=0;
        }
        else
        {
          Type=6;
          coment_br--;
        }
      }
      else if (k!=71)
        Type=6;
      continue;
     case 8:        // comment '/'
      if (k==71)    // *
        coment_br++;
      if (k!=74)
        Type=6;
      continue;
     case 9:   // comment %
      if (k==130 || string[i_poin]==10)
      {
        AddInfo[AddInfo_br++]=HALF|(i_poin+read_br-newline_br); // SyntColor
        Type=0;
      }
      continue;
     case 10:   // beginning of number, after 0
      switch (k)
      {
       case 38:  // 'b'
        Type=14;
        goto R8;
       case 46:  // 'j'
        Type=24;
        goto R8;
       case 51:  // 'o'
        Type=15;
        goto R8;
       case 60:  // 'x'
        Type=16;
        goto R8;
       case 137:  // '''
        Type=17;
R8:     atom_br=1;
        break;
       case 67:  // '.'
        Type=18; // one more digit
        goto R9;
       case 14:  // 'E'
       case 41:  // 'e'
        Type=22; // one more digit
        goto R9;
       default:
        if (k>9)
        {
          i=0;
          goto R5;
        }
        Type=13;
R9:     atom_buf[atom_br++]=string[i_poin];
      }
      continue;
     case 13:   // continue of desimal
      if (k>9)
      {
        if (k==67)  // '.'
        {
          Type=18; // one more digit
          goto R9;
        }
        if (k==14 || k==41)  // 'E' 'e'
        {
          Type=22; // one more digit
          goto R9;
        }
        atom_buf[atom_br]=0;
        sscanf((LPSTR)atom_buf, "%d", &i);
R5:     ArType[array_br]=130;
R5p:    Array[array_br]=i;
        ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
        Left[array_br++]=list_br;
        list[list_br]=list_br?list[list_br-1]:0;  // '_' var
        list_br++;
        goto R3;
      }
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 14:   // continue of binary
      if (k>1)
      {
        if (k<10)
        {
          err_code=10; // error in binary
          goto err;
        }
        int w=atom_br;
        int pow=1; 
        for (i=0; w--; )
        {
          if (atom_buf[w]=='1')
            i+=pow;
          pow*=2;
        }
        goto R5;
      }
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 15:   // continue of octal
      if (k>7)
      {
        if (k<10)
        {
          err_code=11; // error in octal
          goto err;
        }
        atom_buf[atom_br]=0;
        sscanf((LPSTR)atom_buf, "%o", &i);
        goto R5;
      }
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 16:   // continue of hexadesimal
      if (k>42 || (k>15 && 37>k))
      {
        atom_buf[atom_br]=0;
        sscanf((LPSTR)atom_buf, "%x", &i);
        goto R5;
      }
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 24:   // continue of object
      if (k>9)
      {
        atom_buf[atom_br]=0;
        sscanf((LPSTR)atom_buf, "%d", &i);
        ArType[array_br]=132;
        goto R5p;
      }
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 17:   // continue of 0'
      if (atom_br==1 || (atom_br==2 && (kl==63 || (136<kl && kl<140))))  // '\' or "'`
      {
        atom_buf[atom_br++]=string[i_poin];
        continue;
      } 
      else  // can not 0'/23/ ==23!
      {
        if (atom_br==2)
          i=atom_buf[1];
        else if (atom_buf[1]=='\\')
        {
          switch(atom_buf[2])
          {
           case '\\':
           case '\'':
           case '\"':
           case '`':
            i=atom_buf[2];
            break;
           case 'a':
            i='\a';
            break;
           case 'b':
            i='\b';
            break;
           case 'f':
            i='\f';
            break;
           case 'n':
            i='\n';
            break;
           case 'r':
            i='\r';
            break;
           case 't':
            i='\t';
            break;
           case 'v':
            i='\v';
            break;
           default:
            err_code=12; // error after 0'
            goto err;
          }
        }
        else if (atom_buf[1]==atom_buf[2])
          i=atom_buf[1];
        else
        {
          err_code=12; // error after 0'
          goto err;
        }
        goto R5;
      }
     case 22:   // one more digit, real after E (without point)
     case 19:   // the same but it is already real (with point)
      if (k==72 || k==73) // '+' or '-'
      {
        Type=23;
        atom_buf[atom_br++]=string[i_poin];
        continue;
      }
     case 23:   // one more digit, real after E+
     case 18:   // one more digit, real after point
      if (k>9)
      {
        if (Type==23)
        {
          err_code=13; // Incorrect floating-point number with E but without the power
          goto err;   
        }
        
        BYTE symbol=atom_buf[atom_br-1];
        
        atom_buf[atom_br-1]=0;
        if (Type==19) // float
        {
          sscanf((LPSTR)atom_buf, "%f", (float*)&i);
          ArType[array_br]=131;
          ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
        }
        else          // integer
        {
          sscanf((LPSTR)atom_buf, "%d", &i);
          ArType[array_br]=130;
          ArPos[array_br]=i_poin+read_br-newline_br-1; // SyntColor
        }
        Array[array_br]=i;
        Left[array_br++]=list_br;
        list[list_br]=list_br?list[list_br-1]:0;  // '_' var
        list_br++;
        atom_buf[0]=key_map[symbol];
        atom_br=1;
        if (symbol=='.')            // symbol
        {
          Type=2;
          goto R12;
        }
        Type=1;
        goto R11;
      }
      Type=(Type==18)?20:21;
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 20:   // digits after point
      if (k>9)
      {
        if (k==14 || k==41)  // 'E' 'e'
          Type=19; // one more digit (but it is already real)
        else
          goto R10;
      }
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 21:   // digits after E
      if (k>9)
      {
R10:    atom_buf[atom_br]=0;
        sscanf((LPSTR)atom_buf, "%f", (float*)&i);
        ArType[array_br]=131;
        Array[array_br]=i;
        ArPos[array_br]=i_poin+read_br-newline_br; // SyntColor
        Left[array_br++]=list_br;
        list[list_br]=list_br?list[list_br-1]:0;  // '_' var
        list_br++;
        goto R3;
      }
      atom_buf[atom_br++]=string[i_poin];
      continue;
     case 11:   // on err: surching for the full stop
      if (kl==67 && (k==129 || k==130) && (kll<63 || 79<kll) && (a&1)+(b&1)==0)
      {
#if !CONSOLE
        if (FromW&16)
        {
          if (i_poin==0)
          {
            i_poin++;
            goto again;
          }  
          AddInfo[AddInfo_br++]=QUARTER|(i_poin+read_br-newline_br-1); // SyntColor
          flush_fl=0;
          goto s_color;
        }
#endif // !CONSOLE
        if (k==130 && !(FromW&16))
          newline_br--;
        return(0);
      }
      else if (k==138)    // "
        a++;
      else if (k==139)    // `
        b++;
      kll=kl;
      continue;
    }
err:Warning(err_code+50, FromW, 0, 0);
    if (FromW&1) // 1 or 3 or 5
    {
      if (error==1 && (FromW&7)==1 && pActiveCtrl)
      {
        pActiveCtrl->SetSel(i_poin+read_br-newline_br, i_poin+read_br-newline_br+1); //-newline_br
        //SendMessage (hwndTemp, EM_SCROLLCARET, 0, 0);
        pMainFrame->PostMessage(WM_USER+3, 0, 0);
      }      
      Type=11;
      kll=127;
      a=b=0;
      continue;
    }  
    else if ((FromW&7)==0)
      i_poin=f_end; // "You are wrong. Please type again."
    return(0); // it was missing?!
  }
R2:
  if (array_br==1)
  {
    err_code=9; // Empty clause
#if !CONSOLE
    if (FromW&16)
      goto err;
    else
#endif
      goto back;
  }
  for (i=1; i<array_br; i++)
  {
    if (ArType[i]>255) // 256, 257, 258
    {
      if (ArType[i]==257)
      {
        if (!(FromW&16))
          ArType[i]=256;
      }
      else if (Pointers[Array[i]]&OBSEG6) // op
      {
        ArType[i]=119;
        Array[i]=D_field[(Pointers[Array[i]]&MASKA3)+7];
        if (ArType[i+1]==121)
          ArType[i+1]=124;
      }
      else if (ArType[i]==258)
      {
        if (!(FromW&16))
          ArType[i]=256;
        Warning(4, FromW, i, 0); // Warning: has to be an oparator
      }
    }
  }
#if !CONSOLE
  if (FromW&16)
  {
      DWORD j3, color2;

      flush_fl=0;
s_color:
      AddInfo[AddInfo_br]=M1;
      ArType[array_br]=0;
      for (ArPos[array_br]=M1; ar_br2<=array_br || AddInfo[AddInfo_br2]!=M1; )
      {
        if (ArPos[ar_br2]<=(AddInfo[AddInfo_br2]&MASKA2))
        {
          switch (ArType[ar_br2])
          {
           case 127:
           {
            DWORD s=1;
            for (; s<array_br && (ArType[s]!=127 || Array[s]!=Array[ar_br2] || s==ar_br2); s++);
            if (s!=array_br)
              color2=11;
            else  
              color2=12;
            break;  
           }
           case 128:
            color2=10;
            break;  
           case 129:
            color2=1;
            break;  
           case 130:
            color2=2;
            break;  
           case 131:
            color2=3;
            break;  
           case 132:
            color2=4;
            break;  
           case 119:
            color2=5;
            break;  
           case 120:
            {  
              DWORD j=ar_br2-1, m=AddInfo_br2, k=0;
              do
              {
                for (; ArType[j]>126 || ArType[j]<121 || k--; j--);
                for ( k++; m>0 && ArPos[j]<(AddInfo[m-1]&MASKA2); m--)
                  if (!(AddInfo[m-1]&THREE_Q))
                    k++;
              }  
              while(k);
              if (ArType[j]==121)
                color2=8;
              else
                color2=9;
            }  
            break;  
           case 121:
            color2=8;
            break;  
           case 124:
           case 125:
           case 126:
            color2=9;
            break;  
           case 256:
           case 257:
            if (ArType[ar_br2+1]==121)
              color2=8;
            else
              color2=7;
            break;  
           case 258:
            if (ArType[ar_br2+1]==121)
              color2=8;
            else
              color2=13;
            break;  
           default:
            color2=5;
          }
          j3=ArPos[ar_br2++]-read_br;
        }
        else if (AddInfo[AddInfo_br2]==M1)
        {
          if (flush_fl==0)
            color2=5;
          else
            color2=LAST_COLOR; // text end
          j3=i_poin;
          ar_br2++;
        }
        else
        {
          if (AddInfo[AddInfo_br2]&HALF)
            color2=0; // comment
          else if (AddInfo[AddInfo_br2]&QUARTER)
            color2=13; // error
          else
          {  
            int j=AddInfo_br2, k=0;
            for ( ; j>0 && ArPos[ar_br2-1]<(AddInfo[j-1]&MASKA2); j--)
              if (!(AddInfo[j-1]&THREE_Q))
                k++;
            for (j=ar_br2-1;
                  j>=0 && (ArType[j]>126 || ArType[j]<121 || Array[j]!=ar_br2-j-1 || k--); j--);
#if TR
            if (j<0)
              MitiText("Problem with brakets in syntax coloring.\r\n", &cf_red);
#endif
            if (ArType[j]==121)
              color2=8;
            else
              color2=9;
          }  
          j3=(AddInfo[AddInfo_br2++]&MASKA2)-read_br;
        }
        if (synt_color[color1]!=synt_color[color2])
        {  
          if (j2)
          {
            DWORD m, n;
            
#if TR
            if (j1==j2 && color1!=LAST_COLOR) // olmost never - after ().
              MitiText("Empty selection in syntax coloring.\r\n", &cf_red);
#endif
flush4:     if (color1!=LAST_COLOR)
              pAr2->Write(color_string[color1], strlen(color_string[color1]));
            else if (Type<12 && Type>3)
            {
              if (Type<10)
                pAr2->Write(color_string[Type<6], strlen(color_string[Type<6])); // string or comment
              else if (Type==11)  
                pAr2->Write(color_string[13], strlen(color_string[13])); // error
            }
            for(m=n=j1; m<j2; m++)
            {
              if (string[m]<14)
              {
                if (string[m]==13 || string[m]==10) // \r || \n
                {
                  pAr2->Write(string+n, m-n);
                  n=m+1;
                  if (string[m]==10+3*(FromW!=61)) // \n==13 - nothing (or n==10 if at ctr-t)
                    pAr2->Write("\\par\n", 5);  // it was "\\par\r"
                }
              }
              else if (string[m]==92 || string[m]==123 || string[m]==125) // '\' { }
              {
                pAr2->Write(string+n, m-n);
                (*pAr2)<<'\\';
                n=m;
              }
            }
            pAr2->Write(string+n, m-n);
            j1=j2;
          }
          color1=color2;
        }
        if (flush_fl && (j3==i_poin || (flush_fl==2 && j3>L_BUFER%2)))
        {
          if (j2==j3)
          {
            if (j3==i_poin)
            {
              if (flush_fl==1)
                return (0);
              else
              {
                j1=j2=i_poin=0;
                ar_br2--;
                goto flush;
              }
            }    
            else
              goto flush2;
          }
          else
          {
            color2=LAST_COLOR;
            j2=j3;
            goto flush4;
          }  
        }
        j2=j3;
      }
      goto again;
  }
#endif //!CONSOLE

  ArType[0]=124;
  Array[0]=b=array_br-1;
  ReadStack[0]=0;
  Left[0]=0; Right[0]=1;
  Type=0;    // 0 - we wait atom, 1 - we wait operator
  for (i=1, ReSt_br=0; 1; i++)
  {
    while (i>b)
    {
      if (!Type)
      {
        err_code=21;
        i--;
        goto back;
      }
      if (ReSt_br--==0)
        goto R7;
      b=ReadStack[ReSt_br]+Array[ReadStack[ReSt_br]];
    }
    if (Type) // we wait operator
    {
      if (ArType[i]>=124)
      {
        err_code=16;
        goto back;
      }
      if (ArType[i]==119)
      {
        if (!(OpType[Array[i]]&2))
        {
          for ( ; Oper[Array[i]]==Oper[Array[i]+1] && !(OpType[Array[i]]&2); Array[i]++);
          if (!(OpType[Array[i]]&2))
          {
            err_code=15;
            goto back;
          }
        }
        if (ArType[i-1]==119 && (OpType[Array[i-1]]&3)==2     // previous is suffics && not OK
          && (OpPr[Array[i]]<OpPr[Array[i-1]]
             || (OpPr[Array[i]]==OpPr[Array[i-1]] && !(OpType[Array[i]]&16))) )
        {
          err_code=20;
          goto back;
        }
      }
      t=(ArType[i]>=121)?0:((ArType[i]==120)?1000:OpPr[Array[i]]);
      for (kl=k=ReadStack[ReSt_br]; 1; kl=k)     // surch for place
      {
        if (ArType[k=Right[k]]<121)
        {
          switch(ArType[k])
          {
           case 119:
            if (t<OpPr[Array[k]])
              continue;
            else if (t==OpPr[Array[k]])
            {
              if (OpType[Array[i]]&16)   // if !xf - we have not
                break;
              else if (OpType[Array[k]]&8)   // if fy xf - we can and have
                continue;
              else
              {
                err_code=22;
                Warning(72, FromW, i, k);
                goto back2;
              }
            }
            break;
           case 120:
            if (t<1000)
              continue;
            else if (t==1000)
            {
              if (Array[k]==82)
                continue;
              else
              {
                err_code=8; // Cannot put comma or | after | 
                goto back;
              }
            }
          }
        }
        else if (ArType[k]==124 && ArType[Right[k]]==120 && ArType[i]==120) // (a,b),c 
        {
          Right[kl]=Right[k];
#if TR
          MitiText("Here ");
#endif          
          continue;
        }
        Right[kl]=i;
        Left[i]=k;
        if (t==0)    // f(x...
        {
          if (Array[i])
          {
            ReadStack[++ReSt_br]=i;
            b=i+Array[i];
            Right[i]=i+1;
            Type=0;
          }
          else
            Right[i]=0;
        }
        else if (ArType[i]==119 && (OpType[Array[i]]&3)==2)        // xf
          Right[i]=0;
        else                                                    // xfx
        {
          Right[i]=i+1;
          Type=0;
        }
        break;
      }
    }
    else if (ArType[i]>126)     // atom
      Type=1;
    else if (ArType[i]>=124)      // open bracket
    {
      if (!Array[i])
      {
        Array[i]=ArType[i];
        ArType[i]=256;
        Type=1;
      }
      else
      {
        ReadStack[++ReSt_br]=i;
        b=i+Array[i];
        Left[i]=0;
        Right[i]=i+1;
      }
    }
    else if (ArType[i]==119)   // op
    {
      if (OpType[Array[i]]&2)
      {
        for ( ; Oper[Array[i]]==Oper[Array[i]+1] && (OpType[Array[i]]&2); Array[i]++);
        if (OpType[Array[i]]&2)
        {
          err_code=17;
          goto back;
        }
      }
      if (OpType[Array[i]]==0) // term
      {
        Array[i]=Oper[Array[i]];
        ArType[i]=256;
        Type=1;
      }
      else if (ArType[i-1]>120      // prefics && OK
          || ((ArType[i-1]==120)?(OpPr[Array[i]]<=1000):
            (OpPr[Array[i]]<OpPr[Array[i-1]]
             || (OpPr[Array[i]]==OpPr[Array[i-1]] && (OpType[Array[i-1]]&8)))) )
      {
        Left[i]=0;
        Right[i]=i+1;
      }
      else
      {
        err_code=19;
        goto back;
      }
    }
    else if (ArType[i]==120 && Array[i]==83 && i==ReadStack[ReSt_br]+1 // '|' 
            && ArType[ReadStack[ReSt_br]]!=124) // (|x) is nosence!
    {
      Left[i]=0;
      Right[i]=i+1;
    }
    else
    {
      err_code=18;
back: if (!(FromW&16)) // here was newline_br++; but why?
      {
        Warning(err_code+50, FromW, i, AddInfo_br);
back2:  if (error==1 && (FromW&7)==1 && pActiveCtrl)
        {
          if (err_code==9) // Empty clause
            pActiveCtrl->SetSel(i_poin+read_br-newline_br-1, i_poin+read_br-newline_br); //-newline_br
          else
          {
            DWORD n=(i==1)?Program2[program_br]:ArPos[i-1], m=AddInfo_br;
            
            for ( ; m>0 && ArPos[i]<(AddInfo[m-1]&MASKA2); m--);
            if (m>0 && n<(AddInfo[m-1]&MASKA2))
              n=(AddInfo[m-1]&MASKA2);
            pActiveCtrl->SetSel(n, ArPos[i]); //-newline_br
          }
          //SendMessage (hwndTemp, EM_SCROLLCARET, 0, 0);
          pMainFrame->PostMessage(WM_USER+3, 0, 0);
        }
      }
      return(0);
    }
  }
R7:
  sv_subT=0;
  Prog_Obj[program_br]=M1;     // ?
  buf1[0]=0; buf2[0]=M2;
  for (i=Right[0]; 1;)
  {
    if (ArType[i]>126) // Atom
    {
      if (ArType[i]==256)
        tt=Array[i];
      else
      {
        tt=TT_VAR;
        tt_sub=sv_subT;
        if (ArType[i]==127)
          SubstiT[sv_subT++]=(WORD)Array[i];    // list_br
        else
        {
          if (FromW&8)
          {
            if(Prog_Obj[program_br]==M1)
              Prog_Obj[program_br]=++sv_NewObj;
            NewObj[sv_NewObj]=Array[i];
            NewObj1[sv_NewObj]=(BYTE)ArType[i];       // type integer, string or ect.
            NewObj2[sv_NewObj]=SubstiT[sv_subT++]=(WORD)Left[i];    // list_br
            if (sv_NewObj++>NEW_OBJ && correct_NEW_OBJ() )
              MitiText("NEW_OBJ");
            NewObj1[sv_NewObj]=0;
          }
          else
          {
            SubstiT[sv_subT++]=(WORD)Left[i];
            Buda1[buda_br+Left[i]]=ArType[i]+TT_ADD;
            Buda2[buda_br+Left[i]]=Array[i];
            WILL_CLEAN(buda_br+Left[i]);
          }
        }  
      }
      for (t=0; buf_br && buf2[buf_br]!=M1; buf_br--)
      {
        if (buf2[buf_br]==M2) // Bracket or not infics
        {
          switch (ArType[buf1[buf_br]])
          {
           case 119:     // op
            if (t==0 || !(OpType[Array[buf1[buf_br]]]&4))    // fx or fxx
            {
              if (Oper[Array[buf1[buf_br]]]==73 && tt==TT_VAR)  // minus (vremena krypka)
              {
                //SubstiT[tt_sub]==Left[i]
                if (FromW&8)
                {
                  if (ArType[i]==130)
                  {
                    NewObj[sv_NewObj-1]= -(int)NewObj[sv_NewObj-1];
                    break;
                  }
                  else if (ArType[i]==131)
                  {
                    float fl= -(*(float*)&(NewObj[sv_NewObj-1]));
                    NewObj[sv_NewObj-1]= *(int*)&fl;
                    break;
                  }
                }
                else
                {
                  if (ArType[i]==130)
                  {
                    Buda2[buda_br+Left[i]]= -(int)Buda2[buda_br+Left[i]];
                    break;
                  }
                  else if (ArType[i]==131)
                  {
                    float fl= -(*(float*)&(Buda2[buda_br+Left[i]]));
                    Buda2[buda_br+Left[i]]= *(int*)&fl;
                    break;
                  }
                }
              }
              tt=creat_p(2, tt, TT_LIST, tt_sub, 1);
            }
            tt=creat_p(1, OpMin[Array[buf1[buf_br]]], tt, buf_sub[buf_br], tt_sub);
            t=0;
            break;
           case 120:     // prefics '|'
            if (t==0)
              t=1;
            else
            {
err4:         err_code=8;
              Warning(58, FromW, buf1[buf_br], 0); // bug - here always is | but has to be comma or |
              goto back2;
            }
            break;
           case 121:     // f()
            tt=creat_p(1, tt, TT_LIST, tt_sub, 1);
            t=0;
            break;
           case 125:     // {
            if (t==0)
              tt=creat_p(2, tt, TT_LIST, tt_sub, 1); // creat_p is returning in tt_sub
            tt=creat_p(1, TT_SET, tt, 1, tt_sub);
            t=0;
            break;
           case 126:     // [
            if (t==0)
              tt=creat_p(2, tt, TT_LIST, tt_sub, 1);
            t=0;
          }
        }
        else    // f(x or ,| or infics
        {
          if (t==0 && (Array[buf1[buf_br]]!=83 || ArType[buf1[buf_br]]!=120))  
            tt=creat_p(2, tt, TT_LIST, tt_sub, 1);
          if (ArType[buf1[buf_br]]==121)    // f(x 
          {
            tt=creat_p(1, buf2[buf_br], tt, buf_sub[buf_br], tt_sub);
            t=0;
          }
          else if (ArType[buf1[buf_br]]==120)       // ,|
          {
            if (Array[buf1[buf_br]]==83 && t==1)
              goto err4;
            tt=creat_p(2, buf2[buf_br], tt, buf_sub[buf_br], tt_sub);
            t=1;
          }
          else               // infics
          {
            if ((OpType[Array[buf1[buf_br]]]&32)
                || (t && !(OpType[Array[buf1[buf_br]]]&4)))    // xxfxx || xfx
              tt=creat_p(2, tt, TT_LIST, tt_sub, 1);
            tt=creat_p(2, buf2[buf_br], tt, buf_sub[buf_br], tt_sub);
            tt=creat_p(1, OpMin[Array[buf1[buf_br]]], tt, buf_sub[buf_br], tt_sub);
            t=0;            //  !!!****************
          }
        }
      }
      if (buf_br)
      {
        if (t==0 && ArType[buf1[buf_br]]==119 && (OpType[Array[buf1[buf_br]]]&32))  // op && xxfxx
          buf2[buf_br]=creat_p(2, tt, TT_LIST, tt_sub, 1);
        else
          buf2[buf_br]=tt;
        buf_sub[buf_br]=tt_sub;
        i=Right[buf1[buf_br]];
      }
      else
        break;
    }
    else if (ArType[i]>=124 || (ArType[i]==119 && !(OpType[Array[i]]&2))
       || (ArType[i]==120 && Array[i]==83 && !Left[i]))
    {  // Bracket or prefics or prefics '|'
      buf1[++buf_br]=i;
      buf2[buf_br]=M2;
      i=Right[i];
    }
    else    // f(x or ,| or infics or sufics
    {
      buf1[++buf_br]=i;
      if ((ArType[i]==121 && !Array[i]) || (ArType[i]==119 && (OpType[Array[i]]&3)==2))
        buf2[buf_br]=M2;  // f() or sufics
      else
        buf2[buf_br]=M1;
      i=Left[i];
    }
  }
  if (sv_c>=MEMORY_C-256 ) // temporal (it is a problem when the change is in create)
  {
    if (tt>=MEMORY_c256)
      tt+=INCREASE_C;
    correct_MEM_C();
  }
  *ter=tt;
  return(1);
}
void Warning( DWORD code, DWORD FromW, DWORD Arg1, DWORD Arg2)
{
  if (code<51)    // warning
    warn_br++;
  else
    error++;
  if (FromW&32) // don't print in output
    return; 
  if (code<51)    // warning
  {
    sprintf(string2, "Warning %d: ", code);
    MitiText(string2, &cf_green);
  }
  else
  {
    sprintf(string2, "Error %d: ", code-50);
    MitiText(string2, &cf_red);
  }
  switch (code)
  {
   case 1:
    strcpy(string2, "There is a /* in a symbol atom.");
    break;
   case 2:
    strcpy(string2, "Possibly a full stop is glued to an atom.");
    break;
   case 3:
    MitiText("The symbol \'");
    string2[0]=(i_poin)?string[i_poin-1]:0;
    string2[1]=0;
    MitiText(string2, &cf_black);
    strcpy(string2, "\' cannot be in an atom.");
    break;
   case 4:
    MitiText("The string ");
    len=0;
    write_p(Array[Arg1], 4, 0);
    MitiText(string2, &cf_black);
    strcpy(string2, " is not an operator.");
    break;
   case 51:
    strcpy(string2, "Unexpected full stop.");
    break;
   case 52:
    strcpy(string2, "Unexpected ).");
    break;
   case 53:
    strcpy(string2, "Unexpected }.");
    break;
   case 54:
    strcpy(string2, "Unexpected ].");
    break;
   case 55:
    strcpy(string2, "You wrote an empty atom.");
    break;
   case 56:
    strcpy(string2, "You wrote ( ) without a function.");
    break;
   case 57:
    strcpy(string2, "Unexpected end of file.");
    break;
   case 58:
    if (Array[Arg1]==82)
      strcpy(string2, "Cannot put a comma after |.");
    else
      strcpy(string2, "Cannot put | after |.");
    break;
   case 59:
    strcpy(string2, "Empty clause.");
    break;
   case 60:
    strcpy(string2, "Incorrect binary number.");
    break;
   case 61:
    strcpy(string2, "Incorrect octal number.");
    break;
   case 62:
    strcpy(string2, "Incorrect symbol number (0'symbol).");
    break;
   case 63:
    strcpy(string2, "Incorrect floating-point number with E but without the power.");
    break;
   case 64:
    strcpy(string2, "The symbol \\ has to be replaced with \\\\ in the string.");
    break;
   case 65:
    strcpy(string2, "The operator ");
    MitiText(string2);
    len=0;
    write_p(Oper[Array[Arg1]], 4, 0);
et5:MitiText(string2, &cf_black);
    {
      int j=Arg1, m=Arg2, k=0;
      for ( ; m>0 && ArPos[j]<(AddInfo[m-1]&MASKA2); m--);
      j--;
      do
      {
        for (; ArType[j]>126 || ArType[j]<121 || k--; j--);
        for ( k++; m>0 && ArPos[j]<(AddInfo[m-1]&MASKA2); m--)
          if (!(AddInfo[m-1]&THREE_Q))
            k++;
      }  
      while(k);
#if TR
      if (j<0)
        MitiText("Problem with brakets in error.\r\n", &cf_red);
#endif
      sprintf(string2, "%s what is expected here is something like an infix operator or %s.",
        (code==66)?"":((OpType[Array[Arg1]]&1)?" is a prefix but":" is of the type term but"),
        (j>0 && (ArType[j]==121 || ArType[j]==124))?")":((ArType[j]==126)?"]":((ArType[j]==125)?"}":"a full stop")));
    }
    break;
   case 66:
    if (ArType[Arg1]==256)
    {
      strcpy(string2, "Instead of the atom ");
      MitiText(string2);
      len=0;
      write_p(Array[Arg1], 4, 0);
    }
    else if (ArType[Arg1]>126 && ArType[Arg1]<133)
    {
      switch (ArType[Arg1])
      {
       case 127: strcpy(string2, "Instead of variable"); break;
       case 128: strcpy(string2, "Instead of the global variable "); break;
       case 129: strcpy(string2, "Instead of the string "); break;
       case 130: strcpy(string2, "Instead of the integer "); break;
       case 131: strcpy(string2, "Instead of the floating point number "); break;
       case 132: strcpy(string2, "Instead of the object "); break;
      }
      MitiText(string2);
      if (ArType[Arg1]==127)
        string2[0]=0;
      else if (ArType[Arg1]==128)
      {
        int m, n=2;

        string2[0]='G';
        string2[1]='_';
        for(m=global[Array[Arg1]]; m>=TT_START; m=Ufil_c2[m-TT_START])
          string2[n++]=key_oposit[Ufil_c1[m-TT_START]];
        string2[n++]=key_oposit[m];
        string2[n]=0;
      }
      else
      {
        Buda1[0]=ArType[Arg1]+TT_ADD; // Use G_Return
        Buda2[0]=Array[Arg1];
        len=0;
        write_p(TT_VAR, 4, 0);
        Buda1[0]=TT_VAR;
      }
    }
    else // 120 ,| 121(, 124 (, 125 {, 126 [
    {
      strcpy(string2, "Instead of ");
      MitiText(string2);
      switch (ArType[Arg1])
      {
       //case 120: strcpy(string2, "comma"); break;
       case 124: strcpy(string2, "a non-functional bracket"); break;
       case 125: strcpy(string2, "{"); break;
       case 126: strcpy(string2, "["); break;
      }
    }
    goto et5;
   case 67:
    strcpy(string2, "The operator ");
    MitiText(string2);
    len=0;
    write_p(Oper[Array[Arg1]], 4, 0);
et6:MitiText(string2, &cf_black);
    sprintf(string2, " is %s but what is expected %s is a beginning of a term.",
        (code==68)?"an infix operator":((OpType[Array[Arg1]]&1)?"an infix":"a suffix"),
        (ArType[Arg1-1]==120)?((Array[Arg1-1]==83)?"after |":"after a comma"):"here");
    break;
   case 68:
    strcpy(string2, "The symbol ");
    MitiText(string2);
    if (Array[Arg1]==83) // ArType[Arg1]==120
    {
      string2[0]='|';
      string2[1]=0;
    }
    else
      strcpy(string2, "comma");
    goto et6;
   case 69:
    strcpy(string2, "The priority of the prefix operator ");
    MitiText(string2);
    len=0;
    write_p(Oper[Array[Arg1]], 4, 0);
    MitiText(string2, &cf_black);
    if (OpPr[Array[Arg1]]==OpPr[Array[Arg1-1]])
      MitiText(" is equal to the priority of ");
    else
      MitiText(" is lower than the priority of ");
    if (ArType[Arg1-1]==120)
    {
      if (Array[Arg1-1]==83)
        strcpy(string2, "|");
      else
        strcpy(string2, "comma");
    }
    else
    {
      len=0;
      write_p(Oper[Array[Arg1-1]], 4, 0);
    }
    MitiText(string2, &cf_black);
    if (OpPr[Array[Arg1]]==OpPr[Array[Arg1-1]])
    {
      MitiText(" but ");
      MitiText(string2, &cf_black);
      strcpy(string2, " cannot accept operator with the same priority from its right side.");
    }
    else
      strcpy(string2, ". Use brackets to fix this error.");
    break;
   case 70:
    strcpy(string2, "The priority of the suffix operator ");
    MitiText(string2);
    len=0;
    write_p(Oper[Array[Arg1-1]], 4, 0);
    MitiText(string2, &cf_black);
    if (OpPr[Array[Arg1]]==OpPr[Array[Arg1-1]])
      MitiText(" is equal to the priority of ");
    else
      MitiText(" is lower than the priority of ");
    len=0;
    write_p(Oper[Array[Arg1]], 4, 0);
    MitiText(string2, &cf_black);
    if (OpPr[Array[Arg1]]==OpPr[Array[Arg1-1]])
    {
      MitiText(" but ");
      MitiText(string2, &cf_black);
      strcpy(string2, " cannot accept operator with the same priority from its left side.");
    }
    else
      strcpy(string2, ". Use brackets to fix this error.");
    break;
   case 71:
    strcpy(string2, "The last item in an atom-operator sequence has to be an atom or a suffix operator.");
    break;
   case 72:
    strcpy(string2, "You cannot make construction using the operators ");
    MitiText(string2);
    len=0;
    write_p(Oper[Array[Arg1]], 4, 0);
    MitiText(string2, &cf_black);
    MitiText(" and ");
    len=0;
    write_p(Oper[Array[Arg2]], 4, 0);
    MitiText(string2, &cf_black);
    MitiText(". They have equal priority and their types are ");
    MitiText("_fx", &cf_black);
    MitiText(" and ");
    MitiText("xf_", &cf_black);
    string2[0]='.';
    string2[1]=0;
    break;
  }
  if (status_fl&2)  // running
    sprintf(string2+strlen(string2), "\r\n");
  else
  {
    if (program_br1==0)
      strcat(string2, " (in system files ");
    else
      strcat(string2, " (");
    if (program_br-program_br2==0)
      sprintf(string2+strlen(string2), "line %d, before the first clause)\r\n",
               newline_br+1);
    else
      sprintf(string2+strlen(string2), "line %d, after clause %d)\r\n",
               newline_br+1, program_br-program_br2-1);
  }
  MitiText(string2);
}

