Пример #1
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;
}
Пример #2
0
int main(int argc, Char *argv[])
{
  int i;
#ifdef MAC
  argc = 1;		/* macsetup("Fitch","");	*/
  argv[0]="Fitch";
#endif
#ifdef WIN32
  phySetConsoleAttributes();
  phyClearScreen();
#endif
  strcpy(progname,argv[0]);
  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;
  firstset = true;
  doinit();
  if (trout)
    openfile(&outtree,OUTTREE,"output tree file","w",argv[0],outtreename);
  for (i=0;i<spp;++i){
    enterorder[i]=0;}
  for (ith = 1; ith <= datasets; ith++) {
    if (datasets > 1) {
      fprintf(outfile, "Data set # %ld:\n\n",ith);
      if (progress)
        printf("\nData set # %ld:\n\n",ith);
    }
    fitch_getinput();
    for (jumb = 1; jumb <= njumble; jumb++)
        maketree();
    firstset = false;
    if (eoln(infile)) {
      fscanf(infile, "%*[^\n]");
      getc(infile);
    }
  }
  if (trout)
    FClose(outtree);
  FClose(outfile);
  FClose(infile);
#ifdef MAC
  fixmacfile(outfilename);
  fixmacfile(outtreename);
#endif
  printf("Done.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}
Пример #3
0
int main(int argc, Char *argv[])
{  /* main program */
  long i;

#ifdef MAC
  argc = 1;                /* macsetup("Contml","");                */
  argv[0] = "Contml";
#endif
  init(argc, argv);
  emboss_getoptions("fcontml", argc, argv);
  progname = argv[0];

  ibmpc = IBMCRT;
  ansi = ANSICRT;
  firstset = true;
  doinit();

  for (ith = 1; ith <= datasets; ith++) {
    getinput();
    if (ith == 1)
      firstset = false;
    if (datasets > 1) {
      fprintf(outfile, "Data set # %ld:\n\n", ith);
      if (progress)
        printf("\nData set # %ld:\n", ith);
    }
    for (jumb = 1; jumb <= njumble; jumb++)
      maketree();
    if (usertree)
      for (i = 0; i < MAXSHIMOTREES; i++)
        free(l0gf[i]);
  }
  FClose(outfile);
  FClose(outtree);
#ifdef MAC
  fixmacfile(outfilename);
  fixmacfile(outtreename);
#endif
  printf("\nDone.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  ajPhyloFreqDel(&phylofreq);
  ajPhyloTreeDelarray(&phylotrees);

  ajFileClose(&embossoutfile);
  ajFileClose(&embossouttree);

  embExit();
  return 0;
}
Пример #4
0
int main(int argc, Char *argv[])
{  /* main program */
  long i;

#ifdef MAC
  argc = 1;                /* macsetup("Contml","");                */
  argv[0] = "Contml";
#endif
  init(argc, argv);
  progname = argv[0];
  openfile(&infile,INFILE,"input file", "r",argv[0],infilename);
  openfile(&outfile,OUTFILE,"output file", "w",argv[0],outfilename);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  mulsets = false;
  firstset = true;
  datasets = 1;
  doinit();
  if (trout)
    openfile(&outtree,OUTTREE,"output tree file", "w",argv[0],outtreename);
  for (ith = 1; ith <= datasets; ith++) {
    getinput();
    if (ith == 1)
      firstset = false;
    if (datasets > 1) {
      fprintf(outfile, "Data set # %ld:\n\n", ith);
      if (progress)
        printf("\nData set # %ld:\n", ith);
    }
    for (jumb = 1; jumb <= njumble; jumb++)
      maketree();
    if (usertree)
      for (i = 0; i < MAXSHIMOTREES; i++)
        free(l0gf[i]);
  }
  FClose(outfile);
  FClose(outtree);
  FClose(infile);
#ifdef MAC
  fixmacfile(outfilename);
  fixmacfile(outtreename);
#endif
  printf("\nDone.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}
Пример #5
0
char *ReadFileBuf(char *name, int *size)
{
    FILE *fp;
    char *buf, *ext;
    int txt = 1;
    int n;

    ext = GetExt(name);
    if (!StrCmp(ext, ".txt")) {
        txt = 1;
    } else {
        txt = 0;
    }
    fp = FOpen(name, "rb");
    if (fp == NULL) {
        return NULL;
    }
    fseek(fp, 0, SEEK_END);
    n = ftell(fp);
    fseek(fp, 0, SEEK_SET);
    buf = (char *)Malloc(sizeof(char) * n);
    fread(buf, sizeof(char), n, fp);
    if (txt) {
        buf[n - 1] = '\0';
    }
    FClose(fp);
    *size = n;
    return buf;
}
Пример #6
0
/* IsWave: check config parms to see if target is a waveform */
Boolean IsWave(char *srcFile)
{
   FILE *f;
   long nSamp,sampP, hdrS;
   short sampS,kind;
   Boolean isPipe,bSwap,isWave;
   
   isWave = tgtPK == WAVEFORM;
   if (tgtPK == ANON){
      if ((srcFF == HTK || srcFF == ESIG) && srcFile != NULL){
         if ((f=FOpen(srcFile,WaveFilter,&isPipe)) == NULL)
            HError(1011,"IsWave: cannot open File %s",srcFile);
         switch (srcFF) {
         case HTK:
            if (!ReadHTKHeader(f,&nSamp,&sampP,&sampS,&kind,&bSwap))
               HError(1013, "IsWave: cannot read HTK Header in File %s",
                      srcFile);
            break;
         case ESIG:
            if (!ReadEsignalHeader(f, &nSamp, &sampP, &sampS,
                                   &kind, &bSwap, &hdrS, isPipe))
               HError(1013, "IsWave: cannot read Esignal Header in File %s",
                      srcFile);             
            break;
         }
         isWave = kind == WAVEFORM;
         FClose(f,isPipe);
      } else
         isWave = TRUE;
   }
   return isWave;
}
Пример #7
0
static PackFile *PackOpenFromFile(char *name)
{
    FILE *fp;
    PackFile *pack;
    int num, i;
    int packPtr = 0;
    
    fp = FOpen(name, "rb");
    if (fp == NULL) {
        EngineError("not find %s\n", name);
    }
    pack = (PackFile *)Malloc(sizeof(PackFile));
    fread(&num, sizeof(int), 1, fp);
    packPtr += sizeof(int);
    
    pack->file = (struct Data *)Malloc(sizeof(struct Data) * num);
    pack->num  = num;
    for (i = 0; i < pack->num; i++) {
        struct Data *file = &pack->file[i];
        fread(file->name, sizeof(char), MAX_PATH, fp);
        EncodeName(file->name, 0);
        packPtr += sizeof(char) * MAX_PATH;
        fread(&file->size, sizeof(int), 1, fp);
        packPtr += sizeof(int);
        file->ptr = packPtr;
        fseek(fp, file->ptr + file->size, SEEK_SET);
        packPtr += file->size;
        file->data = NULL;
    }
    FClose(fp);
    return pack;
}
Пример #8
0
/* ProcessText: read text files line by line and count ngrams */
void ProcessText(char *fn, bool lastFile)
{
   FILE *f;
   LabId id;
   bool isPipe;
   char word[256];

   if (trace&T_TOP) 
      printf("Reading source text file %s\n",(fn==NULL) ? "<stdin>" : fn);
   if ((fn!=NULL) && (strcmp(fn,"-")!=0)) {
      if ((f = FOpen(fn,LMTextFilter,&isPipe))==NULL)
	 HError(16410,"ProcessText: unable to open text file %s", fn);
   } else {
      f = stdin;
   }
   while (fscanf(f,"%255s",word)==1) {
      if (pruneWords) {
	 if ((id = GetLabId(word,FALSE))==NULL && (id = unkId)==NULL) {
	    stdBuf.used=0;
	    continue;
	 }
      } else {
	 id = GetLabId(word,TRUE);
      }
      if (trace&T_INP) printf("[%s]\n",id->name);
      PutShiftRegister(id,&stdBuf);
   }
   if (fn!=NULL) {
      FClose(f,isPipe);
      if (lastFile)
	 CompressBuffer(stdBuf.ngb,TRUE);
   } else {
      CompressBuffer(stdBuf.ngb,TRUE);
   } 
}
Пример #9
0
void sendmesg(per_request* reqInfo, char *url, FILE *fp)
{
    char *loc, *furl;

    loc = newString(HUGE_STRING_LEN,STR_REQ);
    furl = newString(HUGE_STRING_LEN,STR_REQ);

    FClose(fp);
    if (!strstr(url, "://")) {   /*** If not a full URL ***/
      if (url[0] != '/') { /*** Relative URL ***/ 
        char *last = strrchr(reqInfo->url,'/');
        int x = 0, y = 0;
        while (((reqInfo->url+x) <= last) && (y < HUGE_STRING_LEN)) {
          loc[y] = *(reqInfo->url+x);
          x++; y++;
        }
        loc[y] = '\0';
	strncat(loc,url,HUGE_STRING_LEN - y);
      } else {
        strncpy(loc,url,HUGE_STRING_LEN);
      }
      construct_url(furl, reqInfo->hostInfo, loc);
      die(reqInfo,SC_REDIRECT_TEMP,furl);
    } else {
      die(reqInfo,SC_REDIRECT_TEMP,url);
    }
}
Пример #10
0
/*
 *	Saves the list of parameters to file.
 *
 *      The given file_format is a hint to the file's format.
 *
 *      Returns non-zero on error.
 */
int SARParmSaveToFile(
        const char *filename, int file_format,
        void **parm, int total_parms,
        void *client_data,
        int (*progress_func)(void *, long, long)
)
{
        int status = -1;
        FILE *fp;


        if(filename == NULL)
            return(status);

        /* Open file for writing. */
        fp = FOpen(filename, "wb");
        if(fp == NULL)
            return(status);

        /* Save by file format type. */
	if(1)
        {
            status = SARParmSaveToFileAny(
                filename, fp,
                parm, total_parms,
                client_data, progress_func
            );
        }

        /* Close file. */
        FClose(fp);

        return(status);
}
Пример #11
0
BOOL CMFile::FDeleteFile()
{
	if(bDontClose) return FALSE;
	if (FileOpen)
		FClose();
	return DeleteFile(File->GetFilePath());
}
Пример #12
0
int main(int argc, Char *argv[])
{  /* main program */
#ifdef MAC
  argc = 1;		/* macsetup("Neighbor","");		*/
  argv[0] = "Neighbor";
#endif
#ifdef WIN32
  phySetConsoleAttributes();
  phyClearScreen();
#endif
  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);
    }
    getinput();
    maketree();
    if (eoln(infile)) {
      fscanf(infile, "%*[^\n]");
      getc(infile);
    }
    ith++;
  }
  FClose(infile);
  FClose(outfile);
  FClose(outtree);
#ifdef MAC
  fixmacfile(outfilename);
  fixmacfile(outtreename);
#endif
  printf("Done.\n\n");
#ifdef WIN32
  phyRestoreConsoleAttributes();
#endif
  return 0;
}
Пример #13
0
CMFile::~CMFile()
{	
	if(!bDontClose)
	{
		FClose();
		if ( File != NULL)	delete File;
	}
}
/* Export number of frames, mean, var to a given directory */
void ExportNMV(SpkrAccListItem *sal, char *OutDirName, char *tgtPKStr) 
{
   FILE *oFile;
   Boolean isPipe;
   char oFileName[MAXSTRLEN];
   char pathBuffer1[MAXSTRLEN];
   char pathBuffer2[MAXSTRLEN];
   SpkrAccListItem *p;
   int i;

   p = sal;
   while(p != NULL){
      /* create output file name for current spkr index */    
      if ( pathPattern[0] != '\0'){
         if ( MaskMatch(pathPattern,pathBuffer1,p->sa->SpkrName) != TRUE ){
            HError(2039,"HCompV: ExportNMV: path pattern matching failure on speaker: %s\n",p->sa->SpkrName);
         }
         MakeFN(pathBuffer1,OutDirName,NULL,pathBuffer2); 
         MakeFN(p->sa->SpkrName,pathBuffer2,NULL,oFileName);
      }
      else
         MakeFN(p->sa->SpkrName,OutDirName,NULL,oFileName);

      /* open and write */
      oFile = FOpen(oFileName,NoOFilter,&isPipe);
      if (oFile == NULL){
         HError(2011,"HCompV: ExportNMV: output file creation error %s",oFileName);
      }
    
      /* write header */
      fprintf(oFile,"<CEPSNORM> <%s>",tgtPKStr);
    
      /* write number frames */
      if (strchr(oflags,'n')){
         fprintf(oFile,"\n<NFRAMES> %d",p->sa->NumFrame);
      }
      /* write mean */
      if (strchr(oflags,'m')){
         fprintf(oFile,"\n<MEAN> %d\n",vSize);
         for (i=1;i<=vSize;i++){
            fprintf(oFile," %e",(p->sa->meanSum[i]));
         }
      }
      /* write variance */
      if (strchr(oflags,'v')){   
         fprintf(oFile,"\n<VARIANCE> %d\n",vSize);
         for (i=1;i<=vSize;i++){
            fprintf(oFile," %e",(p->sa->squareSum[i]));
         }
      }
      fprintf(oFile,"\n");
      FClose(oFile,isPipe);
      p = p->nextSpkr;
   }
}
Пример #15
0
static void gui_download_window_done(struct gui_download_window *dw)
{
	struct dlnode *dln,*dln2 = NULL;
	struct browser_window *bw;
	bool queuedl = false;

	if(!dw) return;
	bw = dw->bw;

	if((nsoption_bool(download_notify)) && (dw->result == AMINS_DLOAD_OK))
	{
		Notify(ami_gui_get_app_id(), APPNOTIFY_Title, messages_get("amiDownloadComplete"),
				APPNOTIFY_PubScreenName, "FRONT",
				APPNOTIFY_BackMsg, dw->fname,
				APPNOTIFY_CloseOnDC, TRUE,
				APPNOTIFY_Text, dw->fname,
				TAG_DONE);
	}

	download_context_destroy(dw->ctx);

	if((dln = dw->dln))
	{
		dln2 = (struct dlnode *)GetSucc((struct Node *)dln);
		if((dln!=dln2) && (dln2)) queuedl = true;

		free(dln->filename);
		Remove((struct Node *)dln);
		FreeVec(dln);
	}

	FClose(dw->fh);
	SetComment(dw->fname, dw->url);

	downloads_in_progress--;

	DisposeObject(dw->objects[OID_MAIN]);
	DelObject(dw->node);
	if(queuedl) {
		nsurl *url;
		if (nsurl_create(dln2->node.ln_Name, &url) != NSERROR_OK) {
			amiga_warn_user("NoMemory", 0);
		} else {
			browser_window_navigate(bw,
				url,
				NULL,
				BW_NAVIGATE_DOWNLOAD,
				NULL,
				NULL,
				NULL);
			nsurl_unref(url);
		}
	}
	ami_try_quit(); /* In case the only window open was this download */
}
Пример #16
0
void ami_fetch_file_free(void *vf)
{
	struct ami_file_fetch_info *fetch = (struct ami_file_fetch_info*)vf;
	/* LOG(("ami file fetcher free %lx",fetch)); */

	if(fetch->fh) FClose(fetch->fh);
	if(fetch->mimetype) free(fetch->mimetype);
	if(fetch->path) free(fetch->path);

	DelObject(fetch->obj); // delobject frees fetch
}
Пример #17
0
void ami_fetch_file_abort(void *vf)
{
	struct ami_file_fetch_info *fetch = (struct ami_file_fetch_info*)vf;

	/* LOG(("ami file fetcher abort")); */

	if (fetch->fh) {
		FClose(fetch->fh);
		fetch->fh = 0;
	}
	fetch->aborted = true;
}
Пример #18
0
/* WriteMatBigram: write out old HVite format bigram */
static void WriteMatBigram(LModel *lm,char *fn,int flags)
{
   const float epsilon = 0.000001;
   MatBiLM *matbi;
   FILE *file;
   Boolean isPipe;
   Vector v;
   double x,y;
   int i,j,rep;

   if (trace&T_TIO)
      printf("\nMB "),fflush(stdout);

   matbi = lm->data.matbi;
   file=FOpen(fn,LangModOFilter,&isPipe);

   for (i=1;i<=matbi->numWords;i++) {
      if (trace&T_TIO) {
         if ((i%25)==0)
            printf(". "),fflush(stdout);
         if ((i%800)==0)
            printf("\n   "),fflush(stdout);
      }

      fprintf(file,"%-8s ",ReWriteString(matbi->wdlist[i]->name,
                                         NULL,ESCAPE_CHAR));

      v=matbi->bigMat[i];rep=0;x=-1.0;
      for (j=1;j<=matbi->numWords;j++){
         y = L2F(v[j]);
         if (fabs(y - x) <= epsilon) rep++;
         else {
            if (rep>0) {
               fprintf(file,"*%d",rep+1);
               rep=0;
            }
            x = y;
            if (x == 0.0)
               fprintf(file," 0");
            else if (x == 1.0)
               fprintf(file," 1");
            else
               fprintf(file," %e",x);
         }
      }
      if (rep>0)
         fprintf(file,"*%d",rep+1);
      fprintf(file,"\n");
   }
   FClose(file,isPipe);
   if (trace&T_TIO)
      printf("\n"),fflush(stdout);
}
Пример #19
0
/*
  Debug_DumpNet

*/
void Debug_DumpNet (LexNet *net)
{
   int i, j, k, N;
   LexNode *ln;
   LexNodeInst *inst;
   TokenSet *ts;
   RelToken *rtok;
   FILE *debugFile;
   Boolean isPipe;
   static char *debug_net_fn = "net.dump";

   debugFile = FOpen (debug_net_fn, NoOFilter, &isPipe);
   if (!debugFile) {
      printf ("fopen failed\n");
      return;
   }

   fprintf (debugFile, "(LexNet *) %p\n", net);
   fprintf (debugFile, "nNodes %d\n", net->nNodes);

   for (i = 0; i < net->nNodes; ++i) {
      ln = &net->node[i];
      inst = ln->inst;
      if (inst) {
         fprintf (debugFile, "node %d  (LexNode *) %p", i, ln);
         fprintf (debugFile, " type %d nfoll %d", ln->type, ln->nfoll);
         if (ln->type == LN_MODEL)
            fprintf (debugFile, " name %s", 
                    FindMacroStruct (net->hset, 'h', ln->data.hmm)->id->name);
         fprintf (debugFile, "\n");
         
         assert (inst->node == ln);
         fprintf (debugFile, " (LexNodeInst *) %p", inst);
         fprintf (debugFile, "  best %f\n", inst->best);
         N = (ln->type == LN_MODEL) ? ln->data.hmm->numStates : 1;
         for (j = 0; j < N; ++j) {
            ts = &inst->ts[j];
            if (ts->n > 0) {
               fprintf (debugFile, "  state %d (TokenSet *) %p", j+1, ts);
               fprintf (debugFile, "   score %f\n", ts->score);
               for (k = 0; k < ts->n; ++k) {
                  rtok = &ts->relTok[k];
                  fprintf (debugFile, "   (RelToken *) %p", rtok);
                  fprintf (debugFile, "    delta %f  lmstate %p lmscore %f\n", 
                          rtok->delta, rtok->lmState, rtok->lmscore);
               }
            }
         }
      }
   }

   FClose (debugFile, isPipe);
}
Пример #20
0
nserror
gui_window_save_link(struct gui_window *g, nsurl *url, const char *title)
{
	char fname[1024];
	STRPTR openurlstring,linkname;
	struct DiskObject *dobj = NULL;

	linkname = ASPrintf("Link_to_%s",FilePart(nsurl_access(url)));

	if(AslRequestTags(savereq,
		ASLFR_Window, g->shared->win,
		ASLFR_SleepWindow, TRUE,
		ASLFR_TitleText,messages_get("NetSurf"),
		ASLFR_Screen,scrn,
		ASLFR_InitialFile,linkname,
		TAG_DONE))
	{
		strlcpy(fname, savereq->fr_Drawer, 1024);
		AddPart(fname,savereq->fr_File,1024);

		ami_set_pointer(g->shared, GUI_POINTER_WAIT, false);

		if(ami_download_check_overwrite(fname, g->shared->win, 0))
		{
			BPTR fh;

			if((fh = FOpen(fname,MODE_NEWFILE,0)))
			{
				/* \todo Should be URLOpen on OS4.1 */
				openurlstring = ASPrintf("openurl \"%s\"\n",nsurl_access(url));
				FWrite(fh,openurlstring,1,strlen(openurlstring));
				FClose(fh);
				FreeVec(openurlstring);
				SetComment(fname, nsurl_access(url));

				dobj = GetIconTags(NULL,ICONGETA_GetDefaultName,"url",
									ICONGETA_GetDefaultType,WBPROJECT,
									TAG_DONE);		

				dobj->do_DefaultTool = "IconX";

				PutIconTags(fname,dobj,
							ICONPUTA_NotifyWorkbench,TRUE,
							TAG_DONE);

				FreeDiskObject(dobj);
			}
			FreeVec(linkname);
		}
		ami_reset_pointer(g->shared);
	}
	return NSERROR_OK;
}
Пример #21
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 */
Пример #22
0
   enterId=GetLabId("!ENTER",TRUE);   /* All sentences should or are coerced */

   exitId=GetLabId("!EXIT",TRUE);     /*  to start enterId and end exitId */

   unknownId=GetLabId("!NULL",TRUE);  /* Name for words not in list */



   while (NextArg() == SWITCHARG) {

      s = GetSwtArg();

      if (strlen(s)!=1) 
Пример #23
0
static void PackClose(PackFile *pack)
{
    if (!pack) {
        WriteLog("free pack file\n");        
        return;
    }
    Free(pack->file);
    Free(pack);
    if (packFile != NULL) {
        FClose(packFile);
    }
    WriteLog("free pack file\n");
}
Пример #24
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 */
Пример #25
0
      switch(s[0]){

      case 'b':

         saveLatBin = TRUE; break;    

      case 'm':

         if (bType != unknown)

            HError(3019,"HBuild: Can only specifiy one of -m, -n, -w, -x");

         bType = matBiGram;
Пример #26
0
void SetFileTime2(const String & fn, const FILETIME * creationTime,
  const FILETIME * lastAccessTime, const FILETIME * lastWriteTime)
{
  HANDLE h = FOpen(fn, OPEN_WRITE_BUF, 0);
  if (!h)
  {
    Error2(LOC(L"Error.FileOpen"), fn, ::GetLastError());
  }
  else
  {
    SetFileTime2(h, creationTime, lastAccessTime, lastWriteTime);
    FClose(h);
  }
}
Пример #27
0
void WriteLog(PCHAR buf, WORD len)
{
  WORD F;
  if (LogPath != NULL)
   {
    F = FOpen((PCHARFAR)&LogPath);
    if (F == 0xffff)
    {
     F = FCreate((PCHARFAR)&LogPath);
    }
    FSize(F);
    FWrite(F, (PCHARFAR)buf, len);
    FClose(F);
   }
}
Пример #28
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);
  emboss_getoptions("ffreqboot", argc, argv);
  ibmpc = IBMCRT;
  ansi = ANSICRT;
  doinput(argc, argv);
  bootwrite();
  FClose(infile);
  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
  embExit();
  return 0;
}
Пример #29
0
static PackFile *PackOpen(char *name)
{
    FILE *fp;
    char tmp[MAX_PATH];

    RemoveExt(tmp, name);
    StrCat(tmp, MAX_PATH, ".txt");
    fp = FOpen(tmp, "r");
    if (fp) {
        fgets(tmp, MAX_PATH, fp);
        FClose(fp);
        packFile = FOpen(tmp, "rb");
        return PackOpenFromFile(tmp);        
    }
    packFile = FOpen(name, "rb");
    return PackOpenFromFile(name);
}    
Пример #30
0
         frcDisc = TRUE; break;

      case 'e':

         gen = GetChkedLong(gst,LONG_MAX,s); break;

      case 'h':

         srcHdr = TRUE; break;

      case 'i':

         nItems = GetChkedInt(1,100,s); break;

      case 'n':

         numS = GetChkedInt(1,SMAX-1,s); break;

      case 'o':

         obsFmt = TRUE; break;

      case 'p':

         replay = TRUE; break;

      case 'r':

         rawOut = TRUE; break;

      case 's':

         gst = GetChkedLong(0,LONG_MAX,s); break;

      case 't':

         tgtHdr = TRUE; break;

      case 'z':

         prData = FALSE; break;

      case 'F':

         if (NextArg() != STRINGARG)