Пример #1
0
fileinfo* openTmpFile(const char* tmpfilename, const char* mode) {
  fileinfo* newfile = (fileinfo*)malloc(sizeof(fileinfo));

  newfile->filename = astr(tmpfilename);
  newfile->pathname = genIntermediateFilename(tmpfilename);
  openfile(newfile, mode);

  return newfile;
}
Пример #2
0
void openCFile(fileinfo* fi, const char* name, const char* ext) {
  if (ext)
    fi->filename = astr(name, ".", ext);
  else
    fi->filename = astr(name);

  fi->pathname = genIntermediateFilename(fi->filename);
  openfile(fi, "w");
}
Пример #3
0
int main(int argc, Char *argv[])
{  /* Read in sequences or frequencies and bootstrap or jackknife them */
#ifdef MAC
  argc = 1;                /* macsetup("SeqBoot","");                */
  argv[0] = "SeqBoot";
#endif
  init(argc,argv);
  openfile(&infile, INFILE, "input file", "r", argv[0], infilename);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  doinput(argc, argv);
  bootwrite();
  
  freenewer();
  freenew();
  freerest();

  if (nodep)
    matrix_char_delete(nodep, spp);
  if (nodef)
    matrix_double_delete(nodef, spp);

  FClose(infile);
  if (factors) {
    FClose(factfile);
    FClose(outfactfile);
  }
  if (weights)
    FClose(weightfile);
  if (categories) {
    FClose(catfile);
    FClose(outcatfile);
  }
  if(mixture)
    FClose(outmixfile);
  if(ancvar)
    FClose(outancfile);
  if (justwts && !permute) {
    FClose(outweightfile);
  }
  else
    FClose(outfile);
#ifdef MAC
  fixmacfile(outfilename);
  if (justwts && !permute)
    fixmacfile(outweightfilename);
  if (categories)
    fixmacfile(outcatfilename);
  if (mixture)
    fixmacfile(outmixfilename);
#endif
  printf("Done.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}
Пример #4
0
Chan*
netifopen(Netif *nif, Chan *c, int omode)
{
	Proc *up = externup();
	int id;
	Netfile *f;

	id = 0;
	if(c->qid.type & QTDIR){
		if(omode != OREAD)
			error(Eperm);
	} else {
		switch(NETTYPE(c->qid.path)){
		case Ndataqid:
		case Nctlqid:
			id = NETID(c->qid.path);
			openfile(nif, id);
			break;
		case Ncloneqid:
			id = openfile(nif, -1);
			c->qid.path = NETQID(id, Nctlqid);
			break;
		default:
			if(omode != OREAD)
				error(Ebadarg);
		}
		switch(NETTYPE(c->qid.path)){
		case Ndataqid:
		case Nctlqid:
			f = nif->f[id];
			if(netown(f, up->user, omode&7) < 0){
				netifclose(nif, c);
				error(Eperm);
			}
			break;
		}
	}
	c->mode = openmode(omode);
	c->flag |= COPEN;
	c->offset = 0;
	c->iounit = qiomaxatomic;
	return c;
}
Пример #5
0
 void MainWindow::creatconnect()
 {
     //slot
     connect(load, SIGNAL(clicked()), this, SLOT(openfile()));
     connect(count, SIGNAL(clicked()), this, SLOT(countholl()));
     connect(send,SIGNAL(clicked()),this,SLOT(wirtecomm()));
     connect(time,SIGNAL(timeout()),this,SLOT(readcomm()));//定时溢出实现读串口操作
     connect(finish,SIGNAL(clicked()),this,SLOT(closeThread()));//测试用的
     connect(compiler,SIGNAL(clicked()),this->textTop,SLOT(compilegcode()));
     //        connect(commthread,SIGNAL(finished()),this,SLOT(displaycomm()));      //接收信号实现显示
     connect(simulation,SIGNAL(clicked()),this,SLOT(simulater()));
     connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
     connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
     connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
     connect(configAct, SIGNAL(triggered()),
             this, SLOT(configsetting()));
     connect(openIniFileAct,SIGNAL(triggered()),
             this,SLOT(openfile()));
 }
Пример #6
0
int main(int argc, Char *argv[])
{  /* main program */
#ifdef MAC
  argc = 1;                /* macsetup("Neighbor","");                */
  argv[0] = "Neighbor";
#endif
  init(argc, argv);
  openfile(&infile,INFILE,"input file", "r",argv[0],infilename);
  openfile(&outfile,OUTFILE,"output file", "w",argv[0],outfilename);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  mulsets = false;
  datasets = 1;
  doinit();
  if (trout)
    openfile(&outtree,OUTTREE,"output tree file", "w",argv[0],outtreename);
  ith = 1;
  while (ith <= datasets) {
    if (datasets > 1) {
      fprintf(outfile, "Data set # %ld:\n",ith);
      if (progress)
        printf("Data set # %ld:\n",ith);
    }
    inputoptions();
    maketree();
    if (eoln(infile) && (ith < datasets)) 
      scan_eoln(infile);
    ith++;
  }
  FClose(infile);
  FClose(outfile);
  FClose(outtree);
  freerest();
#ifdef MAC
  fixmacfile(outfilename);
  fixmacfile(outtreename);
#endif
  printf("Done.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}
Пример #7
0
void
wtagwrite(Win *w, char *s, int n)
{
	int fd;

	fd = openfile(w, "tag");
	if(write(fd, s, n) != n)
		  fprint(2,"tag write: %r");
	close(fd);
}
Пример #8
0
int main(void)
{
    getarguments();
    openpar();
    openfile();
    docopy();
    cleanup(NULL, 0);
    
    return 0;
}
Пример #9
0
/*用法说明 :
	文件中"#"  号开头的行忽略


*/
int ReadTxtToGetShellByName2(CString fileName,int linecount,struct operat *p)
{
		struct operat newshell;
	struct operat lin;
	int count=0;
	CStdioFile openfile(fileName,CFile::modeRead);				//构造CStdioFile对象
	CString str;
	//命令类型:命令执行时间:参数个数:参数
	while(openfile.ReadString(str))							//读一行数据
	{
		//if(count >20)  
		//	break;
		 WCHAR  fc=str.GetAt(0);
		 CString firc(fc);
		 CString cc(_T("#"));

		if(firc.Compare(cc) ==0)
			 continue;
		//提取文本
		int loct=str.Find(_T(":"));
		CString shelltype=str.Left(loct);

		CString zhong=str.Right(str.GetLength()-loct-1);

		loct=zhong.Find(_T(":"));
		CString time=zhong.Left(loct);
		zhong=zhong.Right(zhong.GetLength()-loct-1);

		loct=zhong.Find(_T(":"));
		CString ParameterNum=zhong.Left(loct);
		CString Parameter=zhong.Right(zhong.GetLength()-loct-1);
	    //新建一个命令节点
		//newshell=new struct operat;
		newshell.Parameter=Parameter;
		newshell.ParameterNum=_wtoi(ParameterNum);
		newshell.shelltype=shelltype;
		newshell.time=_wtoi(time);

		(p[count]).Parameter=newshell.Parameter;
		p[count].ParameterNum=newshell.ParameterNum;
		p[count].shelltype=newshell.shelltype;
		p[count].time=newshell.time;
	    count++;


	 // CString  zuobiao1,shi,zuobiao2;
	 // zuobiao1.Format(_T(" time=%d"),(newshell2->time));
	 // zuobiao2.Format(_T(" ParameterNum=%d"),(newshell2->ParameterNum));
	 // shi=(newshell2->shelltype)+zuobiao1+zuobiao2+newshell2->Parameter;
		//AfxMessageBox(shi);

	}
	openfile.Close();										//关闭文件
      return count;
}
Пример #10
0
Файл: cpp2.c Проект: WangHoi/slc
//
//  amp July 9, 1997
//
//  Use the OS Luke...
//
//  We do the sneaky version and let the OS do all
//  the hard work so we don't have to mess around
//  a lot ;)
//
ReturnCode MultiAssignLoad( struct Global *global, char *incptr, char *filename, char *tmpname )

{ /* MultiAssignLoad */

    struct MsgPort  *FSTask;
    struct DevProc  *DevProc = NULL;
    LONG            RtnCode = FPP_NO_INCLUDE;

    FSTask = GetFileSysTask();

    do
        {
        //
        //  This should not bring up a requester.
        //  check to see if cpp does in fact tweek
        //  the process WindowPtr.
        //
        DevProc = GetDeviceProc( incptr, DevProc );

        if( DevProc )
            {
            SetFileSysTask( DevProc->dvp_Port );

            //
            //  Normally we would pass the lock and filename
            //  to the Load() routine, which would CD to the
            //  directory and Open(filename), but in order to
            //  satisfy the exisiting openfile() function, we
            //  bite the bullet and build the complete pathspec
            //  rather than add the standard Load() routine.
            //
            if( NameFromLock( DevProc->dvp_Lock, tmpname, NWORK ) )
                {
                AddPart( tmpname, filename, NWORK );

                RtnCode = openfile( global, tmpname );

                if( ! RtnCode )
                    break;
                }
            }

        } while ( RtnCode &&
            DevProc &&
            (DevProc->dvp_Flags & DVPF_ASSIGN) &&
            IoErr() == ERROR_OBJECT_NOT_FOUND); /* repeat if multi-assign */

    SetFileSysTask( FSTask );

    if( DevProc )
        FreeDeviceProc( DevProc );

    return RtnCode;

} /* MultiAssignLoad */
Пример #11
0
int main(int argc, char *argv[]) {
  uchar *input_seqfile;
  uchar *temp;
  uint n_seq, x;
  int l;
  FILE *indfile, *strfile, *binfile;

  configure_logmsg(MSG_DEBUG1);
  parse_arguments(&input_seqfile, argc, argv);
  configure_logmsg(verbosity_level);

  logmsg(MSG_INFO,"Output basename set to %s\n",output_basename);

  l = strlen(output_basename);
  MA(temp, (l+6)*sizeof(char));

  strcpy(temp, output_basename);
  strcat(temp, ".ind");
  indfile = openfile(temp, "w", "sequence index file");
  x = INDFILE_MAGIC;
  fwrite(&x, sizeof(uint), 1, indfile);
  
  strcpy(temp, output_basename);
  strcat(temp, ".seq");
  strfile = openfile(temp, "w", "sequence string file");
  x = STRFILE_MAGIC;
  fwrite(&x, sizeof(uint), 1, strfile);

  strcpy(temp, output_basename);
  strcat(temp, ".sbin");
  binfile = openfile(temp, "w", "sequence binary file");
  x = BINFILE_MAGIC;
  fwrite(&x, sizeof(uint), 1, binfile);
  
  n_seq = format_input(input_seqfile, indfile, strfile, binfile);
  fclose(indfile);
  fclose(strfile);
  fclose(binfile);
  logmsg(MSG_INFO,"%d sequences formatted\n",n_seq);

  return 0;
}
Пример #12
0
boolean add_log_filename(char * filename)
{
  register FILE * ofp;
  if( (ofp=openfile(filename,"w")) == NULL) {
    warn("Could not open %s as a log filename",filename);
    return FALSE;
  }
  
  add_log_file(ofp);
  return TRUE;
}
Пример #13
0
int main(int argc, char **argv) {
  struct radixdb db;
  if (argc != 2) {
    fprintf(stderr, "usage: radixdbdump f\n");
    return 1;
  }
  openfile(argv[1], &db);
  radixdb_dump2dot(&db);
  closefile(&db);
  return 0;
}
Пример #14
0
void doit(void) {
  int n,i,hashcomp;
  openfile( WORDVEC_FILE, &leftfile );
  openfile( RIGHT_SINGVEC_FILE, &rghtfile );
  openfile( SINGVAL_FILE, &singfile );
  preparelandr( "", hashrow, hashstep, hashsing, left, right, sing, &hashcomp );
  if (hashcomp<hashsing)
    printf("\n  FEWER THAN EXPECTED SINGULAR VALUES\n");
  for (i=0; i<hashsing; i++)
    fprintf(singfile,"%f\n",sing[i]);
  fclose(singfile);
  for (n=0; n<hashrow; n++)
    for (i=0; i<hashsing; i++)
      fprintf(leftfile,"%f\n",left[n][i]);
  fclose(leftfile);
  for (n=0; n<hashcol; n++)
    for (i=0; i<hashsing; i++)
      fprintf(rghtfile,"%f\n",right[n][i]);
  fclose(rghtfile);
}
Пример #15
0
static int shiftfile(struct logentity* le) 
{
	char tmp[128] = {0};
	sprintf(tmp, "%s.%d", le->fn, le->nextlogno);
	unlink(tmp);
	rename(le->fn, tmp);
	le->nextlogno = (le->nextlogno + 1) % le->maxlognum;
	if(le->nextlogno == 0)
		le->nextlogno = 1;

	return openfile(le->fn);
}
Пример #16
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);

    openfile();
    timer= new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(repaint()));

    timer->start(100);
}
Пример #17
0
int lineCount(CString fileName)
{
	CStdioFile openfile(fileName,CFile::modeRead);				//构造CStdioFile对象
	CString str;
	int count=0;
	while(openfile.ReadString(str))							//读一行数据
	{

			count++;
	}
	return count;
}
Пример #18
0
int save_StringList(StringList *sl, char *file) {
AtomicFile *f;

	if ((f = openfile(file, "w")) == NULL)
		return -1;

	while(sl != NULL) {
		fprintf(f->f, "%s\n", sl->str);
		sl = sl->next;
	}
	return closefile(f);
}
Пример #19
0
int main(int argc, char* argv[]) 
{
	int i, fd;

	for(i = 1; i < argc; ++i) 
	{
		fd = openfile(argv[i]);
		if(fd < 0) continue;
		printlines(fd, argv[i], argc);
		if(close(fd))
			perror("Close");
	}

	if(argc < 2)
	{
		fd = openfile("-");
		printlines(fd, "-", argc);
	}

	return 0;
}
Пример #20
0
int main(int argc, char *argv[])
{
    int  num_epochs  = argc>1 ? atoi(argv[1]) : 0;
    bool do_shuffle  = argc>2 ? *argv[2] == 'y' : false;
    FILE *train_file = openfile( argc>3 ? argv[3] : (char*)"perceptron_train.csv");
    FILE *test_file  = openfile( argc>4 ? argv[4] : (char*)"perceptron_test.csv");

    XDATA xtrain, xtest;
    YDATA ytrain, ytest;
    read_data(train_file, xtrain, ytrain);

    if (num_epochs == 0)
        num_epochs = xtrain.size();
	//read in training data and figure out w based on those
    std::vector<float> w = p_train(xtrain, ytrain, num_epochs, do_shuffle);
    fprintf(stdout, "weight vector = %f %f %f %f\n", w[0],w[1],w[2],w[3]);

    int failcount = 0;
	//read in test data
    read_data(test_file,  xtest,  ytest);
    for (int i=0; i<xtest.size(); i++){
		//call classify on test_file and until it fails just keep going
        int y = p_classify(xtest[i], w);
		//if we fail, it means we need to re classify
        if (y != ytest[i]) { 
			//update the weights since we failed
            update_weights(xtest[i], ytest[i], w);
			//change it so that we learned
            y = p_classify(xtest[i], w);
            if (y != ytest[i]) {
				//update failure count so we know that we got better
                failcount++;
            }
        }
    }

    fprintf(stdout, "Failures = %d\nEpochs = %d\n\n", failcount, num_epochs);
    fprintf(stdout, "Failures in training: %d\n", test_fails);
    return 0;
}
Пример #21
0
int main(int argc,char ** argv)
{
  SignalMap * map;
  int i;
  FILE * sm;
  Sequence * seq;
  SignalSeq * ss;
  FILE * sseqf;

  PackAln * pal;
  AlnBlock * alb;
  DPRunImpl * dpri;


  srandomdev();

  sm = openfile(argv[1],"r");

  dpri = new_DPRunImpl_from_argv(&argc,argv);


  map = read_SignalMap(sm);
  seq = read_fasta_file_Sequence(argv[2]);
  sseqf = openfile(argv[3],"r");

  ss = read_SignalSeq(sseqf);


  assert(map != NULL);
  assert(seq != NULL);
  assert(ss != NULL);

  pal = PackAln_bestmemory_SimpleSignalMat(ss,seq,map,-10,-2,NULL,dpri);

  alb = convert_PackAln_to_AlnBlock_SimpleSignalMat(pal);

  show_alignment_with_fit_SimpleSignalMat(alb,ss,seq,map,stdout);


}
Пример #22
0
Cell *awkgetline(Node **a, int n)	/* get next line from specific input */
{		/* a[0] is variable, a[1] is operator, a[2] is filename */
	Cell *r, *x;
	extern Cell **fldtab;
	FILE *fp;
	char *buf;
	int bufsize = recsize;
	int mode;

	if ((buf = (char *) malloc(bufsize)) == NULL)
		FATAL("out of memory in getline");

	fflush(stdout);	/* in case someone is waiting for a prompt */
	r = gettemp();
	if (a[1] != NULL) {		/* getline < file */
		x = execute(a[2]);		/* filename */
		mode = ptoi(a[1]);
		if (mode == '|')		/* input pipe */
			mode = LE;	/* arbitrary flag */
		fp = openfile(mode, getsval(x));
		tempfree(x);
		if (fp == NULL)
			n = -1;
		else
			n = readrec(&buf, &bufsize, fp);
		if (n <= 0) {
			;
		} else if (a[0] != NULL) {	/* getline var <file */
			x = execute(a[0]);
			setsval(x, buf);
			tempfree(x);
		} else {			/* getline <file */
			setsval(fldtab[0], buf);
			if (is_number(fldtab[0]->sval)) {
				fldtab[0]->fval = atof(fldtab[0]->sval);
				fldtab[0]->tval |= NUM;
			}
		}
	} else {			/* bare getline; use current input */
		if (a[0] == NULL)	/* getline */
			n = getrec(&record, &recsize, 1);
		else {			/* getline var */
			n = getrec(&buf, &bufsize, 0);
			x = execute(a[0]);
			setsval(x, buf);
			tempfree(x);
		}
	}
	setfval(r, (Awkfloat) n);
	free(buf);
	return r;
}
Пример #23
0
DWORD WINAPI
GetPrivateProfileSectionNames(LPTSTR lpszReturnBuffer,
	DWORD nSize,
	LPCTSTR lpFileName)
{
	FILE *file;
	char buffer[BUFSIZ];
	char *ptr;
	size_t len;
	DWORD nResult;

	APISTR((LF_APICALL,
		"GetPrivateProfileSectionNames(LPTSTR=%s,DWORD=%x,LPCTSTR=%s)\n",
		lpszReturnBuffer?lpszReturnBuffer:"NULL",
		nSize,
		lpFileName?lpFileName:"NULL"));

	if ((lpszReturnBuffer == NULL)
	 || (nSize == 0)
	 || (lpFileName == NULL)
	 || ((file = openfile(NULL, lpFileName, "r")) == NULL)
	) {
     	 	APISTR((LF_APIRET,"GetPrivateProfileSection: returning DWORD %x\n",
			0));
		return (0);
	}

	*lpszReturnBuffer = '\0';
	nResult = 0;

	while (fgets(buffer, sizeof(buffer), file) != NULL)
	{
		if (*buffer != '[') continue;
		ptr = strtok(buffer + 1, "]");
		len = strlen(ptr);
		strncpy(lpszReturnBuffer + nResult, ptr, nSize - nResult);
		if (len >= nSize - nResult)
		{
			lpszReturnBuffer[nSize - 1] = '\0';
			lpszReturnBuffer[nSize - 2] = '\0';
			nResult = nSize - 2;
			break;
		}
		nResult += len + 1;
	}

	fclose(file);

     	APISTR((LF_APIRET,"GetPrivateProfileSection: returning DWORD %x\n",nResult));
	return (nResult);

}
Пример #24
0
struct chan *netifopen(struct ether *nif, struct chan *c, int omode)
{
	int id;
	struct netfile *f;

	id = 0;
	if (c->qid.type & QTDIR) {
		if (!IS_RDONLY(omode))
			error(Eperm);
	} else {
		switch (NETTYPE(c->qid.path)) {
			case Ndataqid:
			case Nctlqid:
				id = NETID(c->qid.path);
				openfile(nif, id);
				break;
			case Ncloneqid:
				id = openfile(nif, -1);
				c->qid.path = NETQID(id, Nctlqid);
				break;
			default:
				if (!IS_RDONLY(omode))
					error(Ebadarg);
		}
		switch (NETTYPE(c->qid.path)) {
			case Ndataqid:
			case Nctlqid:
				f = nif->f[id];
				if (netown(f, current->user, omode & 7) < 0)
					error(Eperm);
				break;
		}
	}
	c->mode = openmode(omode);
	c->flag |= COPEN;
	c->offset = 0;
	c->iounit = qiomaxatomic;
	return c;
}
Пример #25
0
int main(int argc, Char *argv[])
{  /* distances from restriction sites or fragments */
#ifdef MAC
  argc = 1;		/* macsetup("Restdist",""); */
  argv[0] = "Restdist";
#endif
#ifdef WIN32
  phySetConsoleAttributes();
  phyClearScreen();
#endif
  strcpy(progname,argv[0]);
  openfile(&infile,INFILE,"input data file","r",argv[0],infilename);
  openfile(&outfile,OUTFILE,"output file","w",argv[0],outfilename);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  mulsets = false;
  datasets = 1;
  firstset = true;
  doinit();
  for (ith = 1; ith <= datasets; ith++) {
    getinput();
    if (ith == 1)
      firstset = false;
    if (datasets > 1 && progress)
      printf("\nData set # %ld:\n\n",ith);
    makedists();
    writedists();
  }
  FClose(infile);
  FClose(outfile);
#ifdef MAC
  fixmacfile(outfilename);
#endif
  printf("Done.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}  /* distances from restriction sites or fragments */
Пример #26
0
void doinput()
{
  /* reads the input data */

  inputnumbers(&spp, &chars, &nonodes, 1);
  words = chars / bits + 1;
  printf("%2ld species, %3ld characters\n", spp, chars);
  printf("\nReading input file ...\n\n");
  getoptions();
  if (weights)
      openfile(&weightfile,WEIGHTFILE,"weights file","r",progname,weightfilename);
  if(ancvar)
      openfile(&ancfile,ANCFILE,"ancestors file", "r",progname,ancfilename);
  if(factors)
      openfile(&factfile,FACTFILE,"factors file", "r",progname,factfilename);

  alloctree(&treenode);
  setuptree(treenode);
  allocrest();
  inputoptions();
  inputdata(treenode, dollo, false, stdout);
}  /* doinput */
Пример #27
0
void MPIOpenFile(FILE **fileptr, char *name, char *namestr, char *mode,
    char *prog, char *name2)
  {
    char buffer[BSZ];
    char namewnode[BSZ];
    int i;
    char *j;
    int IAM;
    MPI_Comm_rank(MPI_COMM_WORLD, &IAM);
    sprintf(namewnode,"%s.%d",name,IAM);
    sprintf(name2,"%s.%d",name,IAM);
    openfile(fileptr,namewnode,namestr,mode,prog,name2);
  }
Пример #28
0
void buildtree()
{
  long i, j, nextnode;
  node *p;

  changed = false;
  newtree = false;
  switch (how) {

  case arb:
    arbitree();
    break;

  case use:
    /* Open in binary: ftell() is broken for UNIX line-endings under WIN32 */
    openfile(&intree,INTREE,"input tree file", "rb",progname,intreename);
    names = (boolean *)Malloc(spp*sizeof(boolean));
    firsttree = true;                       /**/
    nodep = NULL;                           /**/
    nextnode = 0;                           /**/
    haslengths = 0;                         /**/
    zeros = (long *)Malloc(chars*sizeof(long));         /**/
    for (i = 0; i < chars; i++)             /**/
      zeros[i] = 0;                         /**/
    treeread(intree, &root, treenode, &goteof, &firsttree, nodep, &nextnode,
        &haslengths, &grbg, initdolmovenode,false,nonodes);
    for (i = spp; i < (nonodes); i++) {
      p = treenode[i];
      for (j = 1; j <= 3; j++) {
        p->stateone = (bitptr)Malloc(words*sizeof(long));
        p->statezero = (bitptr)Malloc(words*sizeof(long));
        p = p->next;
      }
    } /* debug: see comment at initdolmovenode() */

    /*treeread(which, ch, &root, treenode, names);*/
    for (i = 0; i < (spp); i++)
      in_tree[i] = names[i];
    free(names);
    FClose(intree);
    break;

  case spec:
    yourtree();
    break;
  }
  outgrno = root->next->back->index;
  if (in_tree[outgrno - 1])
    reroot(treenode[outgrno - 1]);
}  /* buildtree */
Пример #29
0
PhasedProtein * read_fasta_PhasedProtein_file(char * file)
{
  PhasedProtein * pp;
  FILE * ifp;

  ifp = openfile(file,"r");

  pp = read_fasta_PhasedProtein(ifp);

  fclose(ifp);

  return pp;

}
Пример #30
0
FILE *redirect(int a, Node *b)	/* set up all i/o redirections */
{
	FILE *fp;
	Cell *x;
	char *fname;

	x = execute(b);
	fname = getsval(x);
	fp = openfile(a, fname);
	if (fp == NULL)
		FATAL("can't open file %s", fname);
	tempfree(x);
	return fp;
}