Example #1
0
static int SystemCall(int mode)
{ 
  char buff[2000];
  int err;
  FILE*f;

  if(!access(FOUT,R_OK)) unlink(FOUT);

  sprintf(buff,"%s/SPheno",SPHENO);
  if(access( buff,X_OK))
  { printf("Executable \n %s\n is not found. Program stops.\n",buff);
    exit(13);
  }  

   f=fopen("Control.in","w");
   fprintf(f,"0       | ErrorLevel\n"
             ".false. ! Calculation of branching ratios\n"
             ".false. ! Calculation of cross sections\n");
   fclose(f);

  err=System(buff);   
  if(err>0) err=slhaRead(FOUT,0); else cleanSLHAdata();
  if(delFiles)
  { unlink(FIN);unlink(FOUT);  
    unlink("Control.in");unlink("Messages.out");unlink("SPheno.out");
  }
          
  return err;
}
Example #2
0
static int readLine(int size, char*buff)
{ int i;
  for(;;)
  {
    int err= getLnPtr(size-1,buff);  
    if(err==-1) return -1;

    nLine++;
    if(err==-2)
    {
       printf("Line %d is too long\n",nLine);  
       cleanSLHAdata();
       return nLine;
    }
    
    for(i=0;buff[i]&&buff[i]==' ';i++);
    if(buff[i]!=0 && buff[i]!='#') 
    { if(_end_ && buff+i == strstr(buff+i,_end_) )  return -1;

/*
      if(i)
      { int k;
        for(k=i;buff[k];k++) buff[k-i]=buff[k];
        buff[k-i]=0; 
      } 
*/           
      return 0;
    }    
  }
}
Example #3
0
static int SystemCall(int mode)
{ 
  char buff[2000];
  int err;

  if(!access(FOUT,R_OK)) unlink(FOUT);

  sprintf(buff,"%s/isajet_slha",ISAJET);
  if(access( buff,X_OK))
  { printf("Executable \n %s\n is not found. Program stops.\n",buff);
    exit(13);
  }
    
  sprintf(buff+strlen(buff)," %s %s",FIN, FOUT);
  err=System(buff); 
   
  if(err>=0) err=slhaRead(FOUT,4); else cleanSLHAdata();
  return err;
}
Example #4
0
int slhaBasicReader( int mode, int (*getLnPar)(int, char*), int *anydate,char * end)
{
  char buff[StrLn],name[StrLn],rest[StrLn];
  int n,err,m1,m4,m8,m2,m16;
  double scale;
  char wTxt[100];

  _end_=end;  
  *anydate=0;
  m1=mode&1;
  m2=mode&2;
  m4=mode&4;
  m8=mode&8;
  m16=mode&16;
  
  nLine=0;
  FError=0;
  getLnPtr=getLnPar;
  
  if(m1==0)cleanSLHAdata();
    
  err=readLine(StrLn,buff);
  if(err){FError=1;  if(err==-1 )  return -3 ; else  return err;}
  
  for(;;) 
  { char*block="BLOCK ";
    int L;
    char * bComm, *c;
    
    bComm=strchr(buff,'#'); if(bComm) bComm[0]=0;
 
    for(L=0;L<6 && buff[L]&& toupper(buff[L])==block[L] ;L++) continue;
    if(L==6)
    { int i;
      if( sscanf(buff+6," %s ",name)!=1)
      { 
         sprintf(wTxt,"SLHAreader: Line %d : block name is absent",nLine);
         addWarning(wTxt);
         if(m2) 
         { cleanSLHAdata();
           printf("%s\n",wTxt);
           addWarning(wTxt);
           FError=1;
           return nLine;
         }
         if(!findNewBlock(buff)) return -1;
         continue;   
      }  

      if(strlen(name)>=BlckLn)
      {
         sprintf(wTxt,"SLHAreader: Line %d: Too long name of BLOCK",nLine);
         addWarning(wTxt);
         if(m2) 
         {  cleanSLHAdata();
           printf("%s\n",wTxt);
           addWarning(wTxt);
            FError=1;
            return nLine;
         }
         if(!findNewBlock(buff)) return -1;
         continue; 
      }
      for(i=0;name[i];i++) name[i]=toupper(name[i]);
/* SPINFO & DCINFO */
      if(strcmp(name,"SPINFO")==0 ||strcmp(name,"DCINFO")==0 )
      { 
       *anydate=1;
       for(;;)
       { err=readLine(StrLn,buff); if(err){ return err;}
         if(sscanf(buff,"%d",&n)!=1)  break; 
         if(n==1) sscanf(buff,"%*d %[^\n]",creator);
         else if(n==2) sscanf(buff,"%*d %[^\n]",version);
         else if(n==4)
         {  cleanSLHAdata();  
            addWarning(buff);
            FError=1;                      
            return -2;
         }
         else if(n==3) addWarning(buff);
       }
      }
/* QNUMBERS */      
      else if( strcmp(name,"QNUMBERS")==0) 
      {  *anydate=1;
         if(m16) { if(!findNewBlock(buff)) return -1; else continue;} 
         else  
         {
           int val;
           qNumberStr * newQ;
           
           if( sscanf(buff+6,"%*s %d", &val)!=1) 
           { 
              sprintf(wTxt,"SLHAreader: line %d No pdg code for Qnumbers",nLine);
              addWarning(wTxt);
              if(m2)
              {  cleanSLHAdata();
                 printf("%s\n",wTxt);
                 addWarning(wTxt);
                 FError=1;
                 return nLine;
              }
              if(!findNewBlock(buff)) { return -1;}
              continue;                                                    
           }
           newQ =(qNumberStr*)malloc(sizeof(qNumberStr));
           newQ->next=qNumberList;
           qNumberList=newQ;
           newQ->pdg=val;
           newQ->txt=getComment(bComm);
           newQ->spinDim=newQ->eQ3=newQ->cDim=newQ->anti=-88888888;
           
           for(;;)
           { err=readLine(StrLn,buff); if(err) return err;
             if(sscanf(buff,"%d %d",&n,&val)!=2)  break;
             switch(n)
             {
               case 1: newQ->eQ3=val;      break;
               case 2: newQ->spinDim=val;  break;
               case 3: newQ->cDim=val;     break;
               case 4: newQ->anti=val;  break;
               default:
               {  
                  sprintf(wTxt,"SLHAreader: line %d: unexpected key for QNUMBERS",nLine);
                  addWarning(wTxt);  
               }
             }
           } 
         }   
      }
      else   
/* NORMAL BLOCK */      
      { blockStr*newBlock;
        if( sscanf(buff+6,"%*s %s", rest)==EOF) scale=-1;  
        else if(sscanf(buff+6,"%*s %*s %lf %s", &scale, rest)!=1)
        { 
           sprintf(wTxt,"SLHAreader: line %d: Unexpected BLOCK specification",nLine);
           addWarning(wTxt);
           if(m2)
           {  cleanSLHAdata();
              printf("%s\n",wTxt);
              addWarning(wTxt);
              FError=1;
              return nLine;
           }
           if(!findNewBlock(buff)) { return -1;}
           continue;       
        }

        *anydate=1;         
        if(m8) for(;;)
        {
          err=readLine(StrLn,buff); if(err) return err;
          if(!isdigit(buff[0])) break;
        }
        else
        {
          newBlock=(blockStr*)malloc(sizeof(blockStr));
          newBlock->next=blockList;
          strcpy(newBlock->name,name);         
          newBlock->dataList=NULL;
          newBlock->scale=scale;
          blockList=newBlock;
          newBlock->txt=getComment(bComm);
          
          for(;;)
          { int err=0,nkey=0,k,keys[KeyMLn];
            long double re=0,im=0;
            blockRec*dr;
            
            err=readLine(StrLn,buff); if(err) return err;

            if(buff[0]!=' ')    break;
            
            bComm=strchr(buff,'#'); if(bComm) bComm[0]=0;
            
            for(c=buff+strlen(buff)-1  ;c>buff && c[0]==' ';c--);
            
            c[1]=0;

            dr=(blockRec*)malloc(sizeof(blockRec));
            dr->next=blockList->dataList;
            blockList->dataList=dr;
            dr->val=0;
            dr->nkey=-1;
            dr->txt=getComment(bComm);
            dr->body=malloc(strlen(buff)+1);
            strcpy(dr->body,buff);
            
            if(c[0]==')') 
            {
              for(;c>buff && c[0]!='(';c--);
              if(2!=sscanf(c,"( %Lf , %Lf)", &re,&im))  err=1; 
            } else
            { char rest[StrLn];
              for(;c>buff && c[0]!=' ';c--);
              if(1!=sscanf(c,"%Lf%s",&re,rest))  err=1;
            }
            if(err) continue;
#ifdef OLD            
            { sprintf(wTxt,"SLHAreader: line %d: Unexpected last token " ,nLine);
              addWarning(wTxt);
              if(m2) { cleanSLHAdata(); printf("%s\n",wTxt); FError=1; return nLine; }
              else continue;                                                                       
            } 
#endif
            else 
            c[0]=0;
            
            for(c=strtok(buff," ");c && nkey<KeyMLn;c=strtok(NULL," "),nkey++)
            {   
              if(1!=sscanf(c,"%d%s",keys+nkey,rest)) { err=1; break;}
            }
          
            if(err) continue;
#ifdef OLD            
            {  
              sprintf(wTxt,"SLHAreader: line %d: Unexpected %d token" ,nLine,nkey+1);
              addWarning(wTxt);
              if(m2) { cleanSLHAdata(); printf("%s\n",wTxt); FError=1; return nLine;}
              else continue; 
            }
#endif
            dr->val=re+I*im;
            dr->nkey=nkey;
            for(k=0;k<nkey;k++) dr->keys[k]=keys[k];          
          }
        } 
      }
    }else