Example #1
0
int informline(long curent, long total)
{  int  xx;
   int res=0;
   static int Y;
   static int X;
   int xm=where_x(), ym=where_y(), fc=fColor,bc=bColor;
  
   if (curent == 0)
   {
      Y=maxRow();
      X=15;
/*      goto_xy(15,Y); scrcolor(Black,Red);
      memset(b,' ',50); b[50] = '\0';
*/
     goto_xy(15,Y); scrcolor(White,Red);
     print(" Calculation in progress. Calculation in progress.");                                                                     
/*            12345678901234567890123456789012345678901234567890 */
/*      print("%s",b); */
      goto_xy(15,Y);
      scrcolor(fc,bc);
      escpressed();
      goto exi;;
   }

   if(X>65 || X<15) X=15;
   
   xx = 15 + (50 * curent) / total;
   if (xx > 65) xx = 65;
   scrcolor(Black,Red);
   goto_xy(X,Y);
   while (where_x() < xx) print("%c",'X');
   if(xx !=X) { X=xx; res=escpressed();}
   if (curent >= total)
   {
      scrcolor(White,Black);
      goto_xy(1,Y); clr_eol();
      goto exi;
   }
   
   exi:
   
   scrcolor(fc,bc); goto_xy(xm,ym);   
   return res;
   
   
}
Example #2
0
void  makeghostdiagr(int dnum,char * fname)
{csdiagram    csd;
 hlpcsptr     gstlist, c;
 vcsect       vcs_copy;
 FILE * diagrq;
   diagrq=fopen(DIAGRQ_NAME,"rb");
   fseek(diagrq,dnum*sizeof(csdiagram),SEEK_SET);
   FREAD1(csd,diagrq);
   {
      outFileOpen(fname);
      writeLabel('%');
      transfdiagr(&csd,&vcs);

      cwtarg(&vcs);
      if (vcs.clrnum == 0) writeF("Color weight equal zero \n"); else
      {
         generateghosts(&vcs,&gstlist);
         if (gstlist == NULL)
			{
            writeF(
               "Diagrams of this type are absent\n");
            csd.status = 2;
            fseek(diagrq,dnum*sizeof(csdiagram),SEEK_SET);
            FWRITE1(csd,diagrq);
         }
         else
         {
            emitfactors();
            c = gstlist;
            vcs_copy = vcs;
            writeF(" total number diagrams of this type is  %u\n",c->maxnum);
            while (c != NULL)
            {
               coloringvcs(c);
               {
                   writeF("  diagrams number =   %u\n",c->num);
                   DiagramToOutFile(&vcs,0,' ');                     
               }               
	       writeF("  GhostFact:=%d$\n",c->sgn);
               vcs = vcs_copy;
               c = c->next;
            }

         }
         eraseghosts(gstlist);
         vcs = vcs_copy;
      }
      writeF("End$\n");
      outFileClose();
      if (escpressed()) goto exi;
   }

exi:
   fclose(diagrq);
}
Example #3
0
void  menu0(int col,int row,char* label, char* menstr ,
	  void (**funcKey)(int) ,char** funcKeyMess, void ** hscr, int* kk)
{  int    i, j, k, col1, npage,lastrow;
   long	  lastpage;
   int    ink;
   int    ncol;
   void * pscr;
   int  fkPos[11];
   int  height;
   char fmt[20];
   int  lastLine;

/* colors */
   int label_fg  =Yellow;
   int label_bg  =Blue;
   int help_fg1  =White;
   int help_fg2  =Black;
   int help_bg   =DarkGray;
   int box_fg    =White;
   int box_bg    =DarkGray;
   int star_fg   =Red;
   int page_fg   =Black;
   int actFunc_fg=Black;
   int actFunc_bg=White;
   int pasFunc_fg=White;
   int pasFunc_bg=DarkGray;

/* save colors */
   int      fcolor_tmp=fColor;
   int      bcolor_tmp=bColor;
   void *hscr_=NULL;
   
   if(hscr==NULL) hscr=&hscr_;
   lastLine=maxRow();
   if (funcKey == NULL) for (i=0;i<11;i++) fkPos[i]=0; else
   {  int xx;
      scrcolor(FGmain,BGmain);
      goto_xy(1,lastLine); clr_eol();
      xx=0;
      for (j=0;j<10;j++) { if(funcKey[j] && funcKeyMess[j]) 
                                          xx=xx+4+strlen(funcKeyMess[j]);}
      xx= (80 - xx )/2 ;
      goto_xy(xx,lastLine);
      for (i=0;i<10;i++)
      { fkPos[i]=where_x();
        if (funcKey[i] && funcKeyMess[i])
        { scrcolor(help_fg1,help_bg); print(" F%i-",i+1);
          scrcolor(help_fg2,help_bg); print(funcKeyMess[i]);
        }
      }
      fkPos[10]=where_x();
   }

   clearTypeAhead();

   if (*kk < 0) *kk = -(*kk);
      ncol=menstr[0];
      sprintf(fmt,"%%%d.%ds",ncol,ncol);
      height=strlen(menstr)/ncol;
      if(height==0) { *kk=0; return; }
      if (row+height+1 >lastLine-2) height=lastLine-3-row;
      lastpage = 1+    (strlen(menstr)/ncol -1)/height ;
   if(label[0] ==0 || row == 1) 
   { if (*hscr == NULL)  get_text(col,row,col+ncol+1,row+2,hscr);} 
   else
   {  char label_[STRSIZ];
      int shft,sz;
      if (*hscr == NULL) get_text(col,row-1,col+ncol+1,row+2,hscr); 
      for(i=0;i<ncol+2;i++) label_[i]=' ';
      label_[ncol+2]=0;  
      sz=strlen(label);
      if(sz >ncol+2) {shft=0;sz=ncol+2;} else shft=(ncol+2 -sz)/2;  
      memcpy(label_+shft,label,sz); 
      scrcolor(label_fg,label_bg);
      goto_xy(col,row-1);
      print(label_);
   }

   get_text(col,row + 3,col + ncol + 1,row + height + 1,&pscr);

   if (*kk <= 0  || *kk > lastpage * height   )
   {  npage = 1;
      k = 1;
   }
   else {
      k = ((*kk) - 1) % height + 1;
      npage = ((*kk) - 1) / height + 1;
   }
   col1 = col + 1;

label_1:
      scrcolor(box_fg,box_bg);
      chepbox(col,row,col + ncol + 1,row + height + 1);
      scrcolor(star_fg,box_bg);
      goto_xy(col+1,row); print("<");
/*      goto_xy(col+1,row + height+1);  print("?"); */
      scrcolor(page_fg,box_bg);
      if (npage > 1)
      {
         goto_xy(col + ncol - 2,row);
         print("PgUp");
      }
      if (npage < lastpage)
      {
         goto_xy(col + ncol - 2,row + height + 1);
         print("PgDn");
      }

      if(npage<lastpage) lastrow=height;
		  else   lastrow = (strlen(menstr)/ncol)%height;

   lastrow=0;
   scrcolor(pasFunc_fg,pasFunc_bg);
   for (j = 1; j <= height; j++)
   {  int shift;
      goto_xy(col + 1,row + j);
      shift=1+(j-1 + (npage-1)*height)*ncol;
      if(shift<strlen(menstr)) {print(fmt,menstr+shift );lastrow++;}
		 else           print(fmt," ");

   }

   scrcolor(actFunc_fg,actFunc_bg);
   if (k > lastrow) k = lastrow;
   goto_xy(col + 1,row + k);
   if (lastrow) print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol);
   while (1)
   {  int jump=1,mousePos;

      scrcolor(pasFunc_fg,pasFunc_bg); 

      ink = inkey();
/* mouse filter */
      if ((ink==KB_MOUSE)&&(mouse_info.but1 == 2))
      {
         if (mouse_info.row == lastLine )
         for(i=0; i<10;i++)
         if ((mouse_info.col > fkPos[i]) && (mouse_info.col < fkPos[i+1]))
         {  if (i==9)ink='0'; else ink='1'+i;}

         if ( (mouse_info.col >= col ) && (mouse_info.col <=col+ncol+1) )
         {  mousePos = mouse_info.row - row;

            if (col+ncol+1-mouse_info.col <4)
            {
               if (mousePos==0)        ink=KB_PAGEU;
               if (mousePos==height+1) ink=KB_PAGED;
            }

            if ((mousePos == 0 ) && ( mouse_info.col-col <4)) ink=KB_ESC;

            if ((mousePos < 0)&&(mousePos >= height))
            {
               if (mousePos > k)  {ink=KB_DOWN; jump=mousePos - k;}
               if (mousePos < k)  {ink=KB_UP;   jump=k - mousePos;}
               if (mousePos==k )   ink=KB_ENTER;
            }
         }
      }
/* end of filter */
      if (lastrow == 0) goto label_3;
label_4:
      switch (ink)
      {
        case KB_MOUSE:
        if (mouse_info.but1 != 2) break;
        if (mouse_info.row == lastLine )
        for(i=0; i<10;i++)
          if ((mouse_info.col > fkPos[i]) && (mouse_info.col < fkPos[i+1]))
          {  if (i==9)ink='0'; else ink='1'+i;
             goto label_4;
          }

        if ( (mouse_info.col < col ) || (mouse_info.col >col+ncol+1) ||
             (mouse_info.row < row ) || (mouse_info.row >row+height+1) ) break;

           mousePos = mouse_info.row - row;
           if ((mousePos == 0 ) && ( mouse_info.col-col <4)) ink=KB_ESC;
           if ((mousePos != 0)&&(mousePos != height+1))
           {
              if  (mousePos > k)  { ink=KB_DOWN; jump=mousePos - k;}
              if (mousePos < k      ) { ink=KB_UP;   jump=k - mousePos;}
           }
           if (col+ncol+1-mouse_info.col <4)
           {
              if (mousePos==0)        ink=KB_PAGEU;
              if (mousePos==height+1) ink=KB_PAGED;
           }
           if (mousePos==k       ) ink=KB_ENTER;
           if (ink!=KB_MOUSE) goto label_4;

          break;

		  case  KB_DOWN: 
           if(k==lastrow)
           { 
              if(npage < lastpage)
              {  k=1;
                 npage++;
                 goto label_1;
              } else { be_be(); break; }           
           }else {ink= KB_RIGHT; goto label_4;}

		  case  KB_UP: 
           if(k==1)
           {
              if (npage > 1)
	      {
                 k=height;
		 npage--;
		 goto label_1;
              }
              else{ be_be(); break; }           
           }
           else {ink= KB_LEFT; goto label_4;}

		  case KB_LEFT: 
            goto_xy(col1,row + k);
	    print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol);
            k = k - jump;
            if (k == 0) k = lastrow;
            scrcolor(actFunc_fg,actFunc_bg);
            goto_xy(col1,row + k);
	    print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol);
         break;

                  case KB_RIGHT:
	    goto_xy(col1,row + k);
	    print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol);
            k = k + jump ;
            if(k > lastrow) k = 1;
            scrcolor(actFunc_fg,actFunc_bg);   
            goto_xy(col1,row + k);
	    print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol);
         break;

                  case KB_ENTER:
            scrcolor(box_fg,box_bg);
            chepbox(col,row,col+ncol+1,row+2);
            put_text(&pscr);
            goto_xy(col1,row + 1);
            scrcolor(actFunc_fg,actFunc_bg);
	    print(fmt,menstr+1+(k-1+(npage-1)*height)*ncol);
            *kk = (npage - 1) * height + k;
            goto_xy(1,lastLine);scrcolor(FGmain,BGmain); clr_eol();
            if(hscr==&hscr_) put_text(hscr); 
            refresh_scr();
            escpressed();
            return;

			case  KB_BACKSP:
			case  KB_ESC:
            goto label_3;

			case KB_PAGEU:
            if (npage > 1)
            {
               npage--;
               goto label_1;
            }
            else
               be_be();
         break;

			case KB_PAGED:
            if (npage < lastpage)
            {
               npage++;
               goto label_1;
            }
            else
               be_be();
	    break;

	case  '1':  case'2':	   case  '3':	case  '4':	case  '5':
	case '6':   case '7':	case  '8':	case  '9':	case  '0':
	case KB_F1: case KB_F2: case KB_F3: case KB_F4: case KB_F5:
	case KB_F6: case KB_F7: case KB_F8: case KB_F9: case KB_F10:
	{  int fk;
           if (funcKey==NULL) break;
	   if ( ink>='0' && ink <='9') { fk=ink-'0';if (fk==0) fk=10;}
	      else fk=ink-KB_F1+1;
	   if ((funcKey[fk-1]) != NULL)
           {  void * saveHlp;
	      get_text(1,lastLine,maxCol(),lastLine,&saveHlp);
	      scrcolor(box_fg,box_bg);
	      goto_xy(col+1,row); print("%c",boxFrame[1]);
	      goto_xy(1,lastLine);scrcolor(FGmain,BGmain);clr_eol();
	      (*funcKey[fk-1])((npage-1)*height+k);	 
	      put_text(&saveHlp);
	      scrcolor(star_fg,box_bg);
	      goto_xy(col+1,row); print("<");
	   }
           break;
        }
        case 6:  /* ^F */
        case 'f':
        case 'F':
        {  char name[32]="";
           int key=correctStr(5,23,"Enter name(Esc for exit):",name,30,1);
           if(key)
           { char * x=strstr(menstr+1,name);
             if(x==NULL) 
             {
               if(blind) sortie(121); else messanykey(10,10, "Not detected"); 
               break;
             }
             k= ((x-menstr)-1)/menstr[0];
             npage = k/ height + 1;
             k = k% height + 1;
             goto label_1;
           }
        } break; 
     }
  }

label_3:
   put_text(hscr);
   put_text(&pscr);
   scrcolor(fcolor_tmp,bcolor_tmp);
   goto_xy(1,lastLine); clr_eol();
   *kk = 0;
}
Example #4
0
void  mk_reduceprograms(void)
{
   int          ndel, ncalc, nrest, i;
   long         nrecord, naxu;
   csdiagram    csd;
   unsigned     ncalctot;
   shortstr     txt;
   hlpcsptr     gstlist, c;
   vcsect       vcs_copy;
   s_listptr    d_facts, df;
   rmptr        t_fact;

   goto_xy(1,21); scrcolor(Yellow,Blue);
   print("  REDUCE code generation \n");
   scrcolor(Red,BGmain);
   print(" Generated........\n");
   print(" current diagram :\n");
   scrcolor(Yellow,Blue);
   print(" Press Esc to halt REDUCE codes generation ");
   scrcolor(FGmain,BGmain);
   diagrq=fopen(DIAGRQ_NAME,"rb");
   ncalctot = 0;
   menuq=fopen(MENUQ_NAME,"rb");

   for(nsub=1;nsub<=subproc_sq;nsub++) 
   {
      rd_menu(2,nsub,txt,&ndel,&ncalc,&nrest,&nrecord);
      fseek(diagrq,nrecord*sizeof(csdiagram),SEEK_SET);
      naxu = ndel + ncalc + nrest;
      for (ndiagr = 1; ndiagr <= naxu; ndiagr++)
      {
	 goto_xy(20,22); print("%u",ncalctot);
	 goto_xy(20,23); print("%u",ndiagr); clr_eol();
         FREAD1(csd,diagrq);
         if (csd.status != -1)
         { 
            outFileOpen("%sresults%cp%d_%d.red",pathtouser,f_slash,nsub,ndiagr);
            writeLabel('%');
            writeF("%%\n");
            
            transfdiagr(&csd,&vcs);

            cwtarg(&vcs);
            if (vcs.clrnum == 0)
            {
               writeF(
                  "%%-------  Zero color factor --------\n");
               writeF("totFactor_:=0$\n");
               writeF("numerator_:=0$\n");
               writeF("denominator_:=1$\n");
            }
            else
            {
               generateghosts(&vcs,&gstlist);
               if (gstlist == NULL)
               {
                  writeF( "%%-------  non-existent diagram  --------\n");
                  writeF("totFactor_:=0$\n");
                  writeF("numerator_:=0$\n");
                  writeF("denominator_:=1$\n");
               }
               else
               {
		  goto_xy(40,23);
		  print("(%% %4d subdiagrams)",gstlist->maxnum);
		  writeF("%% The total number of diagrams %d\n",gstlist->maxnum);
                  preperdiagram();
                  head();
                  emitfactors();
                  diagramsrfactors(gstlist,&d_facts,&t_fact);
                  writeF("totFactor_:=%s$\n",rmonomtxt(*t_fact));

                 writeF("totFactor_:="
                       "totFactor_*SymmFact*AverFact*FermFact*ColorFact$\n");
                 
                  clrvm(t_fact->n.v);
                  clrvm(t_fact->d.v);
                  free(t_fact);

                  writesubst();
                  writeF("numerator_:=0$\n");

                  c = gstlist;
                  df = d_facts;
                  vcs_copy = vcs;
                  while (c != NULL)
                  {
                     coloringvcs(c);
                     writeF("%%  diagram  number =   %d\n", c->num);
                     DiagramToOutFile(&vcs,1,'%');

                     {int k; int sgn=c->sgn;
                      for(k=0;k<vcs.sizet;k++) sgn*=vertexes[k].lgrnptr->factor;
                      writeF("  GhostFact:=%d$\n",sgn);
                     }
                     
		     findReversVert();
                     attachvertexes();

                     emitreducecode();

                     writeF(" numerator_:=numerator_ +(%s)*GhostFact*Vrt_1 $\n",
                        smonomtxt(df->monom));
                     writeF(" Clear Vrt_1,GhostFact$\n");
                     writeF("%%\n");

                     vcs = vcs_copy;
                     c = c->next;
                     df = df->next;
                  }

                  eraseslist(d_facts);
                  eraseghosts(gstlist);

                  vcs = vcs_copy;
                  emitdenoms();
	          writeF(" Clear p%d",nin + nout + 1);
                  for (i = nin + nout + 2; i <= 12; i++)
	          writeF(",p%d",i);
                  writeF("$\n");
                  writeF("%%\n");

               }
            }
            writeF("End$\n");
            outFileClose();
            --(nrest);
            ++(ncalctot);
            if (escpressed()) goto exi;
         }
      }
   }

exi: 
   fclose(diagrq); fclose(menuq);
   clrbox(1,21,70,24);

}
Example #5
0
static void  writesubprocess(int nsub,long firstDiag,long totDiag,int* breaker)
{  denlist    den_;
   int      i;
    
   deninforec   dendescript;
   FILE * fd;                /* file of (deninforec)  */
   char fd_name[STRSIZ];
   marktp mem_start;

   nsub1 = nsub;

   { outFileOpen("%sresults%cd%d.c",pathtouser,f_slash,nsub);
     labl();
     writeF("#include\"num_in.h\"\n");
     writeF("#include\"num_out.h\"\n");
   }

   if(totDiag==0) 
   { writeF("extern DNN S%d_ext;\n",nsub); 
     writeF("REAL S%d_ext(double GG,  REAL * momenta,int * err)\n{",nsub); 
     writeF("  return 0;\n}\n");
     outFileClose(); 
     return;
   }

   if(sumDiag) writeF("static void C%d(REAL *);\n",nsub); else 
   {  writeF("extern FNN F%d_ext",firstDiag);
      for(i=1;i<totDiag;i++) writeF(",F%d_ext",i+firstDiag);
      writeF(";\n");
      writeF("static FNN *Farr[%d]={&F%d_ext",totDiag,firstDiag);
      for(i=1;i<totDiag;i++) writeF(",&F%d_ext",i+firstDiag);
      writeF("};\n");
   } 
   writeF("extern DNN S%d_ext;\n",nsub);
   writeF("REAL S%d_ext(double GG, REAL * momenta,int * err)\n{",nsub);
   writeF("REAL  ans=0;\n");

   sprintf(fd_name,"%stmp%cden.inf",pathtouser,f_slash);
   fd=fopen(fd_name,"wb"); 

   mark_(&mem_start);
   denominatorStatistic(nsub, &nden_s, &nden_t, &nden_0, &den_, fd); 
   fclose(fd);
   nden_w=nden_s+nden_t;
   writeF("REAL DP[%d];\n",((nin+nout)*(nin+nout-1))/2);
   writeF("REAL* V=va_ext;\n");
   if(nin+nout>3)
   {  int nden= nden_w+nden_0+1; 
      writeF("REAL mass[%d],width[%d];\n",nden,nden);
      writeF("char * Qtxt[%d];\n",nden);
      writeF("REAL Q0[%d]; COMPLEX Q1[%d]; REAL Q2[%d];\n",nden_w+nden_0+1, nden_w+nden_0+1,nden_w+nden_0+1);
//      writeF("sprod_(%d, momenta, DP);\n",nin+nout);
/*      writeF(" for(i=0;i<nin_ext;i++) s0max+=momenta[4*i];\n"); */
   
      for(;den_;den_ = den_->next)
      {  int m=0;
         i=den_->order_num;
         if(den_->width) 
         {
           if(den_->stype) fprintf(outFile,"width[%d]=%s; ",i,vararr[den_->width].alias);
           else 
           {  i+=nden_s;
             fprintf(outFile,"width[%d]=(twidth_ext)? %s : 0.; ",i,vararr[den_->width].alias); 
           }
         }else 
         { i+=nden_w;
           fprintf(outFile,"width[%d]=0.; ",i);
         }
         fprintf(outFile,"mass[%d]=%s; ",i,vararr[den_->mass].alias);
         fprintf(outFile," Qtxt[%d]=\"",i);       
/*         fprintf(outFile," Q[%d]=mass[%d]*mass[%d]-sqrMom(nin_ext,\"",i,i,i);*/

         while(den_->momStr[m]) fprintf(outFile,"\\%o",den_->momStr[m++]);
         fprintf(outFile,"\";\n");
/*         fprintf(outFile,"\",momenta);\n");   */ 
      }  

      writeF("*err=*err|prepDen(%d,nin_ext,BWrange_ext*BWrange_ext,mass,width,Qtxt,momenta,Q0,Q1,Q2);\n",
      nden_w+nden_0);
   }   
   writeF("sprod_(%d, momenta, DP);\n",nin+nout);
   release_(&mem_start);
   fd=fopen(fd_name,"rb"); 
   if(sumDiag)       
   {   
     *breaker = alldiagrams(fd,nsub); 
     writestatistic();   
     outFileClose();    
   } else 
   { 
      writeF("{int i; for(i=0;i<%d;i++) \n",totDiag);
      writeF(
      "{ REAL r=Farr[i](GG,DP,Q0,Q1,Q2);\n"
      "  if(r>Fmax) Fmax=r;\n"
      "  ans+=r;\n"
      "}}\n"
      "return ans;\n}\n"
            );

      outFileClose();

      *breaker = 0;
      while(FREAD1(dendescript,fd) == 1)
      {
         if (escpressed())
         {  *breaker = 1;
            break;
         }
         onediagram(&dendescript);
         writestatistic();
      } 
   }
   fclose(fd);
   unlink(fd_name);
}  /*  WriteSubprocess  */
Example #6
0
static int  alldiagrams(FILE * fd,  int nsub)
{  
   marktp     bh;
   varptr     totnum, totdenum, rnum;
   long       pos_c1,pos_c2; int deg1,deg2,tmpn1,tmpn2, nC;
   catrec     cr;
   deninforec dendescript;

   mark_(&bh); tmpNameMax=0; initinfo(); initdegnames();

   writeF("{\n");
   writeF("REAL N,D,R; COMPLEX Prop;\n");
   pos_c1= ftell(outFile); writeF("%70s\n","");   
   writeF("if(CalcConst) C%d(C);\n",nsub);

   while(FREAD1(dendescript,fd) == 1)
   {
      fseek(catalog,dendescript.cr_pos,SEEK_SET);
      FREAD1(cr,catalog); ++(diagrcount);
      if(!noPict)writpict(cr.ndiagr_ + inftmp->firstdiagpos - 1);
      whichArchive(cr.nFile,'r');
      fseek(archiv,cr.factpos,SEEK_SET);

      readvardef(archiv);
      readpolynom(&totnum);
      readpolynom(&totdenum);
      clearvardef();
   
      fseek(archiv,cr.rnumpos,SEEK_SET);

      readvardef(archiv);
      readpolynom(&rnum);
      clearvardef();
   
      fortwriter("N",totnum);
      fortwriter("D",totdenum);

      fortwriter("R",rnum);

      writeF("R*=(N/D);\n");
      if(nin+nout>3)
      {  writeF("Prop=1");
         writeDenominators(&dendescript);
         writeF("R*=creal(Prop);\n");
         writeF(" if(R>Fmax) Fmax=R; else if(R<-Fmax) Fmax=-R;\n");
      } else  writeF(";\n");
      if(!noCChain)calcColor(cr.ndiagr_+inftmp->firstdiagpos);
      writeF("ans+=R;\n");
   }   
   whichArchive(0,0);
   writeF("\n}\nreturn ans;\n}\n");

   deg1=cleardegnames();
   tmpn1=tmpNameMax;
   tmpNameMax=0;
   initdegnames();

   writeF("\nstatic void C%d(REAL*C)\n{\n",nsub); 
   writeF("  REAL* V=va_ext;\n");
   pos_c2= ftell(outFile); writeF("%70s\n","");   

   nC=write_const(); 
   if(nC==0) nC=1; 
   writeF("}\n");

   fseek(outFile,pos_c1,SEEK_SET); 
   writeF("static REAL C[%d];",nC); 
   if(deg1) writeF("REAL S[%d];",deg1);
   if(tmpn1) writeF("REAL tmp[%d];",tmpn1); 

 
   fseek(outFile,pos_c2,SEEK_SET);
   deg2=cleardegnames();
   tmpn2=tmpNameMax;
   if(deg2) writeF("REAL S[%d];",deg2) ;
   if(tmpn2) writeF("REAL tmp[%d];",tmpn2 );
   fseek(outFile,0,SEEK_END);

   release_(&bh);
   if( escpressed()) return 1; else return 0;
}
Example #7
0
int main(int argc,char** argv)
{
  int n;
  char icon[200];
  char title[30];

  blind=0;
  for( n=1;n<argc;n++) 
  {
    if(strcmp(argv[n],"--version")==0)  {  printf("%s\n",VERSION_); exit(0); }
    if(strcmp(argv[n],"-blind")==0&& n<argc-1 )
    { blind=1;     
      inkeyString=argv[++n];
    } else  if (strcmp(argv[n],"+blind")==0 ) blind=2;
  }

  if(!writeLockFile(".lock"))
  { fprintf(stderr,"locked by other n_calchep. See .lock\n");
    exit(100);
  }
                 
  setenv("CALCHEP",rootDir,0);
  sprintf(pathtocalchep,"%s%c",rootDir,f_slash);
  sprintf(pathtohelp,"%shelp%c",pathtocalchep,f_slash);
  sprintf(icon,"%s/include/icon",pathtocalchep);
  sprintf(title,"CalcHEP_%s/num", VERSION);

  f3_key[2]=f5_key_prog;   f3_mess[2]="Options";
  f3_key[3]=f6_key_prog;   f3_mess[3]="Results";
  f3_key[5]=f8_key_prog;   f3_mess[5]="Calc";
  f3_key[6]=f9_key_prog;   f3_mess[6]="Ref";
  f3_key[7]=f10_key_prog;  f3_mess[7]="Quit";
  
  { int size=100;
     for(;;)
     {  compDir=realloc(compDir,size+20);
        if(getcwd(compDir,size)) break; else size*=2;
     }
     strcat(compDir,"/aux");
     libDir=malloc(strlen(compDir)+20);
     sprintf(libDir,"%s/so_generated",compDir);
     modelNum=1;
     calchepDir=getenv("CALCHEP");
     if(!calchepDir) calchepDir=interface_ext.CALCHEP;
     ForceUG=interface_ext.forceUG;
  }
  

/* **  initialization of the session */
  link_process(PtrInterface_ext);  


  start1(title,icon,"calchep.ini;../calchep.ini",&xw_error);
  nPROCSS=sysconf(_SC_NPROCESSORS_ONLN); 

  if(r_sess__(NULL)==-1)
  { 
     char buff[200];
     int pdg[11]={21,1,-1,2,-2,3,-3,4,-4,5,-5};  
     int k,ok=0;
     strcpy(buff,"{p*\\09");
     for(k=0;k<11;k++)
     {  char*ch=pdg2name(pdg[k]);
        if(ch)
        {  if(ok) strcat(buff,",");
           strcat(buff,ch);
           ok=1;
        }   
     }
     strcat(buff,"}");
     if(ok)
     {  int  blind0=blind;
        char*inkeyString0=inkeyString;    
        inkeyString=buff;
        blind=1;
        edittable(1,4,&compTab,1,"n_comp",0);
        blind=blind0;
        inkeyString=inkeyString0;
        fillCompositeArray();
        
        strcpy(buff,"{%\\09T(p*)\\09 50{%\\09J(p*,p*)\\09 0.5}");
        inkeyString=buff;
        blind=1;
        edittable(1,4,&cutTab,1,"n_cut",0);
        blind=blind0;
        inkeyString=inkeyString0;
     }   
  }
  { char *ch=getenv("nParProc");
    if(ch) sscanf(ch,"%d",&nPROCSS);
  }  
  goto_xy(10,10); print("Calculation of constraints.  Please, be patient.");
  escpressed();
  n_comphep();
  finish();  
  sortie(0);
}