コード例 #1
0
ファイル: Main.cpp プロジェクト: RocketersAlex/LCSource
/* Replace a file with a new file if they are different.
 * Used to keep .h files from constantly changing when you change the implementation. 
 */
void ReplaceIfChanged(const char *strOld, const char *strNew)
{
  int iChanged = 1;
  FILE *fOld = fopen(strOld, "r");
  if (fOld!=NULL) {
    iChanged = 0;
    FILE *fNew = FOpen(strNew, "r");
    while (!feof(fOld)) {
      char strOldLine[4096] = "#l";
      char strNewLine[4096] = "#l";
  
      // skip #line directives
      while(strNewLine[0]=='#' && strNewLine[1]=='l' && !feof(fNew)) {
        fgets(strNewLine, sizeof(strNewLine)-1, fNew);
      }
      while(strOldLine[0]=='#' && strOldLine[1]=='l' && !feof(fOld)) {
        fgets(strOldLine, sizeof(strOldLine)-1, fOld);
      }
      if (strcmp(strNewLine, strOldLine)!=0) {
        iChanged = 1;
        break;
      }
    }
    fclose(fNew);
    fclose(fOld);
  }

  if (iChanged) {
    remove(strOld);
    rename(strNew, strOld);
  } else {
    remove(strNew);
  }
}
コード例 #2
0
ファイル: pack_reader.cpp プロジェクト: f3yagi/mysrc
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;
}
コード例 #3
0
ファイル: sarfiosave.c プロジェクト: hsanjuan/sar2
/*
 *	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);
}
コード例 #4
0
ファイル: LAdapt.c プロジェクト: botonchou/AlgoFinal
/* 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);
   } 
}
コード例 #5
0
ファイル: pack_reader.cpp プロジェクト: f3yagi/mysrc
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;
}
コード例 #6
0
ファイル: Tool_HCopy.c プロジェクト: cfxccn/HTKLib
/* 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
ファイル: pack_reader.cpp プロジェクト: f3yagi/mysrc
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);
}    
コード例 #8
0
/* 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;
   }
}
コード例 #9
0
ファイル: HLM.c プロジェクト: 2hanson/voice_dialling
/* 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);
}
コード例 #10
0
ファイル: HLVRec-misc.c プロジェクト: 2hanson/voice_dialling
/*
  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);
}
コード例 #11
0
ファイル: download.c プロジェクト: arczi84/NetSurf-68k
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;
}
コード例 #12
0
ファイル: HBuild.c プロジェクト: BackupTheBerlios/artbody-svn
   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) 
コード例 #13
0
ファイル: RamanSpectrum.c プロジェクト: xomachine/gabedit
static gboolean read_dalton_file(GabeditFileChooser *SelecFile, gint response_id)
{
	gchar *FileName;
 	FILE *fd;

	if(response_id != GTK_RESPONSE_OK) return FALSE;
 	FileName = gabedit_file_chooser_get_current_file(SelecFile);

 	fd = FOpen(FileName, "rb");
	read_dalton_modes_MOLHES(fd, FileName);
	fclose(fd);
	return TRUE;
}
コード例 #14
0
ファイル: EngineTools.cpp プロジェクト: Release/filecopyex3
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);
  }
}
コード例 #15
0
ファイル: HBuild.c プロジェクト: BackupTheBerlios/artbody-svn
      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;
コード例 #16
0
ファイル: RamanSpectrum.c プロジェクト: xomachine/gabedit
static gboolean read_sample_2columns_file(GabeditFileChooser *SelecFile, gint response_id)
{
 	gchar t[BSIZE];
 	gboolean OK = TRUE;
	gint numberOfFrequencies = 0;
	gdouble* frequencies = NULL;
	gdouble* intensities = NULL;
	gchar *FileName;
 	FILE *fd;
	gdouble a;
	gdouble b;
	int ne = 0;

	if(response_id != GTK_RESPONSE_OK) return FALSE;
 	FileName = gabedit_file_chooser_get_current_file(SelecFile);

 	fd = FOpen(FileName, "rb");
	if(!fd) return FALSE;

 	while(!feof(fd))
	{
	 	if(!fgets(t,BSIZE,fd))break;
		ne = sscanf(t,"%lf %lf",&a,&b);
		if(ne==2)
		{
			numberOfFrequencies++;
			frequencies = g_realloc(frequencies, numberOfFrequencies*sizeof(gdouble));
			intensities = g_realloc(intensities, numberOfFrequencies*sizeof(gdouble));
			frequencies[numberOfFrequencies-1] = a;
			intensities[numberOfFrequencies-1] = b;
		}
 	}

	if(numberOfFrequencies>0)
	{
		createRamanSpectrumWin(numberOfFrequencies, frequencies, intensities);
	}
	else
	{
		OK = FALSE;
		messageErrorFreq(FileName);
	}


	if(frequencies) g_free(frequencies);
	if(intensities) g_free(intensities);
	fclose(fd);
	return OK;
}
コード例 #17
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);
   }
}
コード例 #18
0
ファイル: HList.c プロジェクト: BackupTheBerlios/artbody-svn
         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)
コード例 #19
0
ファイル: HSGen.c プロジェクト: nlphacker/OpenSpeech
/* GenSentences: top level control of the sentence generator */
void  GenSentences(char * latfn, char * dicfn)
{
   int i,min,max,len;
   double e,p;
   MemHeap lheap;
   FILE *f;
   Boolean isPipe;

   InitVocab(&voc);
   if(ReadDict(dicfn,&voc)<SUCCESS)
      HError(3413,"GenSententces:ReadDict failed" );
   CreateHeap(&lheap,"Lattice Heap",MSTAK,1,0.4,1000,5000);
   if ((f=FOpen(latfn,NetFilter,&isPipe)) == NULL)
      HError(3410,"GenSentences: Can't open lattice file %s",latfn);
   if((lat = ReadLattice(f, &lheap, &voc, TRUE, FALSE))==NULL)
      HError(3410,"GenSentences: ReadLattice failed");
   FClose(f,isPipe);

   if (trace&T_TOP)
      printf("HSGen %d sents from lattice %s/dictionary %s\n",
             ngen,latfn,dicfn);
   psSum = 0.0; lenSum = 0; min = 100000; max = 0;
   if (trace&T_DET) quiet = TRUE;  /* kill output if detailed trace */
   for (i=1; i<=ngen; i++){
      len = GenSent(i);
      lenSum += len;
      if (len>max) max = len;
      if (len<min) min = len;
   }
   if (stats)  {
      ComputeVSize();
      e = psSum / lenSum;
      p = exp(e);
      e = e / log(2.0);
      printf("Entropy = %f,  Perplexity = %f\n",e,p);
      printf("%d Sentences: average len = %.1f, min=%d, max=%d\n",
             ngen,(float)lenSum/ngen,min,max);
   }
}
コード例 #20
0
ファイル: PrincipalAxisGL.c プロジェクト: xomachine/gabedit
void save_principal_axis_properties()
{
	gchar *axesfile;
	FILE *file;

	axesfile = g_strdup_printf("%s%sprincipalAxes",gabedit_directory(),G_DIR_SEPARATOR_S);

	file = FOpen(axesfile, "w");

 	fprintf(file,"%d\n",axis.show);
 	fprintf(file,"%d\n",axis.negative);
 	fprintf(file,"%lf %lf %lf\n",axis.origin[0],axis.origin[1],axis.origin[2]);
 	fprintf(file,"%lf\n",axis.radius);
 	fprintf(file,"%lf\n",axis.scal);
 	fprintf(file,"%lf %lf %lf\n",axis.firstColor[0],axis.firstColor[1],axis.firstColor[2]);
 	fprintf(file,"%lf %lf %lf\n",axis.secondColor[0],axis.secondColor[1],axis.secondColor[2]);
 	fprintf(file,"%lf %lf %lf\n",axis.thirdColor[0], axis.thirdColor[1], axis.thirdColor[2]);

	fclose(file);

	g_free(axesfile);
}
コード例 #21
0
ファイル: HNetTest.c プロジェクト: deardaniel/PizzaTest
void LoadNetwork()
{
   FILE *nf;
   Boolean isPipe;
   int n=0;

   CreateHeap(&wdNetHeap,"Lattice heap",MSTAK,1,0.0,4000,4000);
   if ( (nf = FOpen(wdNetFn,NetFilter,&isPipe)) == NULL)
      HError(3210,"LoadNetwork: Cannot open Word Net file %s",wdNetFn);
   if((wdNet = ReadLattice(nf,&wdNetHeap,&vocab,TRUE,FALSE))==NULL)
      HError(3210,"LoadNetwork: ReadLattice failed");
   FClose(nf,isPipe);

   printf("Read Word Network with %d nodes / %d arcs\n",wdNet->nn,wdNet->na);

   CreateHeap(&netHeap,"Net heap",MSTAK,1,0,
      wdNet->na*sizeof(NetLink),wdNet->na*sizeof(NetLink));

   net = ExpandWordNet(&netHeap,wdNet,&vocab,&hset);
   printf("Created network with %d nodes / %d links\n",
      net->numNode,net->numLink);

}
コード例 #22
0
ファイル: HLM.c プロジェクト: 2hanson/voice_dialling
/* WriteBoNGram: write out WSJ/DP format ngram */
static void WriteBoNGram(LModel *lm,char *fn,int flags)
{
   int i,k;
   FILE *file;
   NGramLM *nglm;
   Boolean isPipe;

   nglm = lm->data.ngram;
   file=FOpen(fn,LangModOFilter,&isPipe);
   fprintf(file,"\\data\\\n");

   for (i=1;i<=nglm->nsize;i++) {
      fprintf(file,"ngram %d=%d\n",i,nglm->counts[i]);
   }
   for (i=1;i<=nglm->nsize;i++) {
      k = WriteNGrams(file,nglm,i,1.0/LN10);
      if (k!=nglm->counts[i])
         HError(-8190,"WriteBoNGram: Counts disagree for %dgram (%d vs %d)",
                i, k, nglm->counts[i]);
   }
   fprintf(file,"\n\\end\\\n");
   FClose(file,isPipe);
}
コード例 #23
0
ファイル: HLVRec-misc.c プロジェクト: 2hanson/voice_dialling
void Debug_Dump_LMLA_hastab(DecoderInst *dec)
{
   int i, n;
   LMLACacheEntry *e;

   FILE *debugFile;
   Boolean isPipe;
   static char *debug_net_fn = "lmla_cache.dump";

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

   for (i = 0; i < dec->nLMLACacheBins; ++i) {
      n = 0;
      for (e = dec->lmlaCache[i]; e; e = e->next)
         ++n;
      fprintf (debugFile, "LMLA %d %d\n", i, n);
   }

   FClose (debugFile, isPipe);
}
コード例 #24
0
ファイル: HMGenS.c プロジェクト: nlphacker/OpenSpeech
/* WriteParms: write generated parameter vector sequences */
void WriteParms(char *labfn, GenInfo * genInfo)
{
   int p, t, v, k;
   char ext[MAXSTRLEN], fn[MAXFNAMELEN];
   float ig;
   Vector igvec;
   TriMat igtm;
   FILE *parmfp = NULL, *pdffp = NULL;
   Boolean isPipe1, isPipe2;
   PdfStream *pst;

   /* get ignore value for MSD */
   ig = ReturnIgnoreValue();

   /* save generated parameters */
   for (p = 1; p <= genInfo->nPdfStream[0]; p++) {
      /* p-th PdfStream */
      pst = &(genInfo->pst[p]);

      /* create ignore value vector/triangular matrix */
      igvec = CreateVector(&genStack, pst->vSize);
      igtm = CreateTriMat(&genStack, pst->vSize);
      for (v = 1; v <= pst->vSize; v++) {
         igvec[v] = ig;
         for (k = 1; k <= v; k++)
            igtm[v][k] = ig;
      }

      /* open file pointer for saving generated parameters */
      MakeFN(labfn, genDir, pst->ext, fn);
      if ((parmfp = FOpen(fn, NoOFilter, &isPipe1)) == NULL)
         HError(9911, "WriteParms: Cannot create ouput file %s", fn);

      /* open file pointer for saving pdf parameters */
      if (outPdf) {
         sprintf(ext, "%s_%s", pst->ext, pdfExt);
         MakeFN(labfn, genDir, ext, fn);
         if ((pdffp = FOpen(fn, NoOFilter, &isPipe2)) == NULL)
            HError(9911, "WriteParms: Cannot create output file %s", fn);
      }

      /* output generated parameter sequence */
      for (t = pst->t = 1; t <= genInfo->tframe; t++) {
         if (pst->ContSpace[t]) {
            /* output generated parameters */
            WriteVector(parmfp, pst->C[pst->t], inBinary);

            /* output pdfs */
            if (outPdf) {
               WriteVector(pdffp, pst->mseq[pst->t], inBinary);
               if (pst->fullCov)
                  WriteTriMat(pdffp, pst->vseq[pst->t].inv, inBinary);
               else
                  WriteVector(pdffp, pst->vseq[pst->t].var, inBinary);
            }

            pst->t++;
         } else {
            /* output ignoreValue symbol for generated parameters */
            WriteFloat(parmfp, &igvec[1], pst->order, inBinary);

            /* output ignoreValue symbol for pdfs */
            if (outPdf) {
               WriteVector(pdffp, igvec, inBinary);
               if (pst->fullCov)
                  WriteTriMat(pdffp, igtm, inBinary);
               else
                  WriteVector(pdffp, igvec, inBinary);
            }
         }
      }

      /* close file pointer */
      if (outPdf)
         FClose(pdffp, isPipe2);
      FClose(parmfp, isPipe1);

      /* free igvec */
      FreeVector(&genStack, igvec);
   }

   return;
}
コード例 #25
0
ファイル: Main.cpp プロジェクト: RocketersAlex/LCSource
int main(int argc, char *argv[])
{
  // if there is not one argument on the command line
  if (argc<1+1) {
    // print usage
    printf("Usage: Ecc <es_file_name>\n       -line\n");
    //quit
    return EXIT_FAILURE;
  }
  if(argc>2)
  {
    if(strcmp(argv[2],"-line")==0)
    {
      _bRemoveLineDirective=1;
    }
  }
  // open the input file
  _fInput = FOpen(argv[1], "r");
  //printf("%s\n", argv[1]);
  // open all the output files
  char *strImplementation    = ChangeFileNameExtension(argv[1], ".cpp_tmp");
  char *strImplementationOld = ChangeFileNameExtension(argv[1], ".cpp");
  char *strDeclaration       = ChangeFileNameExtension(argv[1], ".h_tmp");
  char *strDeclarationOld    = ChangeFileNameExtension(argv[1], ".h");
  char *strTables            = ChangeFileNameExtension(argv[1], "_tables.h_tmp");
  char *strTablesOld         = ChangeFileNameExtension(argv[1], "_tables.h");

  _fImplementation = FOpen(strImplementation, "w");
  _fDeclaration    = FOpen(strDeclaration   , "w");
  _fTables         = FOpen(strTables        , "w");
  // get the filename as preprocessor usable identifier
  _strFileNameBase = ChangeFileNameExtension(argv[1], "");
  _strFileNameBaseIdentifier = strdup(_strFileNameBase);
  {char *strNextSlash = _strFileNameBaseIdentifier;
  while((strNextSlash = strchr(strNextSlash, '/'))!=NULL) {
    *strNextSlash = '_';
  }}
  {char *strNextSlash = _strFileNameBaseIdentifier;
  while((strNextSlash = strchr(strNextSlash, '\\'))!=NULL) {
    *strNextSlash = '_';
  }}
  // print their headers
  PrintHeader(_fImplementation );
  PrintHeader(_fDeclaration    );
  PrintHeader(_fTables         );

  // remember input filename
  char strFullInputName[MAXPATHLEN];
  _fullpath(strFullInputName, argv[1], MAXPATHLEN);
  _strInputFileName = strFullInputName;
  TranslateBackSlashes(_strInputFileName);
  // make lex use the input file
  yyin = _fInput;

  // parse input file and generate the output files
  yyparse();

  // close all files
  fclose(_fImplementation);
  fclose(_fDeclaration);
  fclose(_fTables);

  // if there were no errors
  if (ctErrors==0) {
    // update the files that have changed
    ReplaceFile(strImplementationOld, strImplementation);
    ReplaceIfChanged(strDeclarationOld, strDeclaration);
    ReplaceIfChanged(strTablesOld, strTables);
 
    return EXIT_SUCCESS;
  // if there were errors
  } else {
    // delete all files (the old declaration file is left intact!)
    remove(strImplementation);
    remove(strDeclaration   );
    remove(strTables        );
    return EXIT_FAILURE;
  }
}
コード例 #26
0
ファイル: PWSfileV1V2.cpp プロジェクト: macduff/passwordsafe
int PWSfileV1V2::Open(const StringX &passkey)
{
  int status = SUCCESS;

  ASSERT(m_curversion == V17 || m_curversion == V20);

  m_passkey = passkey;
  FOpen();
  if (m_fd == NULL)
    return CANT_OPEN_FILE;

  LPCTSTR passstr = m_passkey.c_str();
  size_t passLen = passkey.length();
  unsigned char *pstr;

#ifdef UNICODE
  size_t pstr_len = 3 * passLen;
  pstr = new unsigned char[pstr_len];
  size_t len = pws_os::wcstombs(reinterpret_cast<char *>(pstr), 3 * passLen, passstr, passLen, false);
  ASSERT(len != 0);
  // hack around OS-dependent semantics - too widespread to fix systematically :-(
  pstr[len < pstr_len ? len : pstr_len - 1] = '\0';
  passLen = strlen(reinterpret_cast<const char *>(pstr));
#else
  pstr = reinterpret_cast<unsigned char *>(passstr);
#endif

  if (m_rw == Write) {
    // Following used to verify passkey against file's passkey
    unsigned char randstuff[StuffSize];
    unsigned char randhash[20];   // HashSize

    PWSrand::GetInstance()->GetRandomData( randstuff, 8 );
    randstuff[8] = randstuff[9] = TCHAR('\0');
    GenRandhash(m_passkey, randstuff, randhash);

    SAFE_FWRITE(randstuff, 1, 8, m_fd);
    SAFE_FWRITE(randhash, 1, 20, m_fd);

    PWSrand::GetInstance()->GetRandomData(m_salt, SaltLength);

    SAFE_FWRITE(m_salt, 1, SaltLength, m_fd);

    PWSrand::GetInstance()->GetRandomData( m_ipthing, 8);
    SAFE_FWRITE(m_ipthing, 1, 8, m_fd);

    m_fish = BlowFish::MakeBlowFish(pstr, reinterpret_cast<int &>(passLen),
                                    m_salt, SaltLength);
    if (m_curversion == V20) {
      status = WriteV2Header();
    }
  } else { // open for read
    status = CheckPasskey(m_filename, m_passkey, m_fd);
    if (status != SUCCESS) {
#ifdef UNICODE
      trashMemory(pstr, pstr_len);
      delete[] pstr;
#endif
      Close();
      return status;
    }
    fread(m_salt, 1, SaltLength, m_fd);
    fread(m_ipthing, 1, 8, m_fd);

    m_fish = BlowFish::MakeBlowFish(pstr, reinterpret_cast<int &>(passLen),
                                    m_salt, SaltLength);
    if (m_curversion == V20)
      status = ReadV2Header();
  } // read mode
 exit:
  if (status != SUCCESS)
    Close();
#ifdef UNICODE
  trashMemory(pstr, pstr_len);
  delete[] pstr;
#endif
  return status;
}
コード例 #27
0
ファイル: imagemap.c プロジェクト: TooDumbForAName/ncsa-httpd
/* NCSA Imagemap files use: method URL coord1 coord2
 * CERN Imagemap files use: method (coord1) (coord2) URL
 * This version of imagemap will probably work with either in the same file,
 * as long as a full line is in one format or the other.
 */
int send_imagemap(per_request* reqInfo, struct stat* fi, char allow_options)
{
    char *input, *def, *szPoint, *url, *type;
    double testpoint[2], pointarray[MAXVERTS][2];
    int i, j, k;
    int error_num = 0;
    FILE *fp;
    char *t;
    double dist, mindist = -1;
    int sawpoint = 0;
    int sawparen = 0;
    int Found = 0;

    
    input = newString(HUGE_STRING_LEN,STR_TMP);
    def = newString(MAX_STRING_LEN,STR_TMP);
    szPoint = newString(MAX_STRING_LEN,STR_TMP);
    type = newString(MAX_STRING_LEN,STR_TMP);
    url = newString(MAX_STRING_LEN,STR_TMP);

    def[0] = '\0';
    strcpy(szPoint, reqInfo->args);

    if(!(t = strchr(szPoint,','))) {
        error_num = IMAP_ERR_INCORRECT_ARGS;
	goto imagemap_error;
    }

    *t++ = '\0';
    testpoint[X] = (double) atoi(szPoint);
    testpoint[Y] = (double) atoi(t);

    if(!(fp=FOpen(reqInfo->filename,"r"))){
	log_reason(reqInfo, "File permissions deny server access",
		   reqInfo->filename);
        freeString(input);
        freeString(def);
        freeString(szPoint);
        freeString(url);
        freeString(type);
	die(reqInfo, SC_FORBIDDEN, reqInfo->url);
    }

    while (!Found && fgets(input,HUGE_STRING_LEN,fp)) {
        char num[10];

        /* Skip lines with # as comments and blank lines */
        if((input[0] == '#') || (!input[0]))
            continue;

        type[0] = '\0';url[0] = '\0';

        /* Copy the shape keyword into type */
        for(i=0;!isspace(input[i]) && (input[i]);i++)
            type[i] = input[i];
        type[i] = '\0';

        /* Forward to next word */
        while(isspace(input[i])) ++i;

        /* If no coordinates, must be url for default, or NCSA format  */
	if (input[i] != '(') {
          for(j=0;input[i] && !isspace(input[i]);++i,++j)
            url[j] = input[i];
          url[j] = '\0';
        }

	/* Handle default keyword */
        if(!strcmp(type,"default") && !sawpoint) {
            strcpy(def,url);
            continue;
        }

        /* Looking for Coordinates */
        k=0;
        while (input[i]) {
	    /* Move over spaces and commas */
            while (isspace(input[i]) || input[i] == ',')
                i++;
	    
	    /* Under CERN, coordinates are in parenthesis */
            if (input[i] == '(') {
                sawparen = 1;
                while (isspace(input[++i]));
            }

            /* Copy digits into num array */
            j = 0;
            while (isdigit(input[i]))
                num[j++] = input[i++];

            num[j] = '\0';
            if (!j) break;
            pointarray[k][X] = (double) atoi(num);

            /* Skip to next digit */
            while (isspace(input[i]) || input[i] == ',')
                i++;
            /* Copy other number into num */
            j = 0;
            while (isdigit(input[i]))
                num[j++] = input[i++];
            num[j] = '\0';

            if (!j && !sawparen && k > 0) {
              pointarray[k++][Y] = -127;
              break;
            }
  
            if (j)
                pointarray[k++][Y] = (double) atoi(num);
            else {
		error_num = IMAP_ERR_INCORRECT_COORDS;
	        FClose(fp);
		goto imagemap_error;
            }
            
            /* End of parenthesis for coordinates under CERN */
            if (input[i] == ')') {
	      i++;
	      sawparen = 0;
	    } else if (sawparen) {
	      error_num = IMAP_ERR_CERN_MISSING_RIGHT_PAREN;
              FClose(fp);
              goto imagemap_error;	
	    }
        }
        if (url[0] == '\0' && input[i]) {
          while (isspace(input[i])) i++;
          for (j = 0; input[i] && !isspace(input[i]); ++i, ++j)
             url[j] = input[i];
          url[j] = '\0';
        }
        pointarray[k][X] = -1;
        if(!strncmp(type, "poly", 4))
            if(pointinpoly(testpoint,pointarray))
	       Found = 1;
        if(!strncmp(type, "circ", 4))
            if(pointincircle(testpoint,pointarray))
	      Found = 1;
        if(!strncmp(type, "rect", 4))
            if(pointinrect(testpoint,pointarray))
	      Found = 1;
        if(!strcmp(type,"point")) {
	    /* Don't need to take square root. */
	    dist = ((testpoint[X] - pointarray[0][X])
		    * (testpoint[X] - pointarray[0][X]))
		   + ((testpoint[Y] - pointarray[0][Y])
		      * (testpoint[Y] - pointarray[0][Y]));
	    /* If this is the first point, or the nearest, set the default. */
	    if ((! sawpoint) || (dist < mindist)) {
		mindist = dist;
	        strcpy(def,url);
	    }
	    sawpoint++;
	}
    }
    if(Found) {
      sendmesg(reqInfo, url, fp);
      goto imagemap_ok;
    } else {
      if(def[0]) {
        sendmesg(reqInfo, def, fp);
	goto imagemap_ok;
      }
    }
/* No reason to log each of these as an "error" */
/*    log_reason(reqInfo, "No default defined in imagemap.",
	       reqInfo->filename); */
    FClose(fp);
    freeString(input);
    freeString(def);
    freeString(szPoint);
    freeString(url);
    freeString(type);
    die(reqInfo, SC_NO_CONTENT, reqInfo->url);
    return 0;
 
 imagemap_ok:
    FClose(fp);
    freeString(input);
    freeString(def);
    freeString(szPoint);
    freeString(url);
    freeString(type);
    return 1;
 
 imagemap_error:
   freeString(input);
   freeString(def);
   freeString(szPoint);
   freeString(url);
   freeString(type);
   log_reason(reqInfo,imagemap_errors[error_num-1],reqInfo->filename);
   die(reqInfo,SC_BAD_IMAGEMAP,imagemap_errors[error_num-1]);
   return -1;
}
コード例 #28
0
ファイル: HDict.c プロジェクト: DorisGao/personal-uni
/* EXPORT->WriteDict: Write the given Vocab structure to the file dictFn */
ReturnStatus WriteDict(char *dictFn, Vocab *voc)
{
   FILE *df;
   Boolean isPipe,withOut,withProbs;
   Word wid, *wlist;
   Pron thisPron;
   float prob;
   char buf[MAXSTRLEN];
   int i,j,nw;

   nw = voc->nwords;
   if (trace&T_TOP)
      printf("WriteDict: %d words/%d prons to %s\n",
             nw,voc->nprons,dictFn);  
   if ( (df = FOpen(dictFn,DictOFilter,&isPipe)) == NULL){
      HRError(8011,"WriteDict: Cannot create dictionary file %s",dictFn);
      return(FAIL);
   }
   /* Create array of words */
   j = 0;
   wlist = (Word *)New(&gstack,sizeof(Word)*(nw+1));
   for (i=0,withOut=withProbs=FALSE; i< VHASHSIZE; i++)
      for ( wid = voc->wtab[i]; wid != NULL; wid = wid->next ) {
         if (wid==voc->nullWord || wid==voc->subLatWord)
            continue;
         if (j>=nw){
            FClose(df, isPipe);
            HRError(8090,"WriteDict: wlist full [%d]",j);
            return(FAIL);
         }
         wlist[j++] = wid;
         for (thisPron = wid->pron; thisPron != NULL; thisPron = thisPron->next) {
            if (thisPron->outSym==NULL || thisPron->outSym != wid->wordName) 
               withOut=TRUE;
            if (thisPron->prob!=0.0)
               withProbs=TRUE;
         }
      }
   if (j!=nw){
      HRError(-8090,"WriteDict: only %d of %d words found",j,nw);
   }
   /* sort list */
   qsort(wlist,nw,sizeof(Word),Wd_Cmp);

   /* print list of prons */
   for (i=0; i<nw; i++){
      wid = wlist[i];
      for (thisPron = wid->pron; thisPron != NULL; thisPron = thisPron->next) {
         ReWriteString(wid->wordName->name,buf,ESCAPE_CHAR);
         fprintf(df,"%s",buf); 
         Pad(df,WORDFIELDWIDTH-strlen(buf),1);
         if (thisPron->outSym==NULL) {
            fprintf(df,"[]");
            Pad(df,WORDFIELDWIDTH-2,0);
         } else if (thisPron->outSym != wid->wordName) {
            ReWriteString(thisPron->outSym->name,buf,ESCAPE_CHAR);
            fprintf(df,"[%s]",buf);
            Pad(df,WORDFIELDWIDTH-strlen(buf)-2,0);
         } else if (withOut)
            Pad(df,WORDFIELDWIDTH,0);
         if (withProbs) {
            prob=(thisPron->prob>LSMALL && thisPron->prob<=0.0)?exp(thisPron->prob):1.0;
            if (prob<1.0) fprintf(df," %8.6f",prob);
            /* 1.0 is just skipped */
            else Pad(df,9,0);
         }

         for (j=0; j < thisPron->nphones; j++) {
            fputc(' ',df);
            WriteString(df,thisPron->phones[j]->name,ESCAPE_CHAR);
         }
         fprintf(df,"\n");
      }
   }
   FClose(df,isPipe);
   return(SUCCESS);
}
コード例 #29
0
ファイル: download.c プロジェクト: arczi84/NetSurf-68k
static struct gui_download_window *gui_download_window_create(download_context *ctx,
		struct gui_window *gui)
{
	const char *url = nsurl_access(download_context_get_url(ctx));
	unsigned long total_size = download_context_get_total_length(ctx);
	struct gui_download_window *dw;
	char *dl_filename = ami_utf8_easy(download_context_get_filename(ctx));
	APTR va[3];

	dw = ami_misc_allocvec_clear(sizeof(struct gui_download_window), 0);

	if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
	{
		strcpy(dw->fname, dw->dln->filename);
		free(dw->dln->node.ln_Name);
		dw->dln->node.ln_Name = NULL;
	}
	else
	{
		if(AslRequestTags(savereq,
			ASLFR_Window, gui->shared->win,
			ASLFR_SleepWindow, TRUE,
			ASLFR_TitleText, messages_get("NetSurf"),
			ASLFR_Screen, scrn,
			ASLFR_InitialFile, dl_filename,
			TAG_DONE))
		{
			strlcpy(dw->fname, savereq->fr_Drawer, 1024);
			AddPart((STRPTR)&dw->fname,savereq->fr_File,1024);
			if(!ami_download_check_overwrite(dw->fname, gui->shared->win, total_size))
			{
				FreeVec(dw);
				return NULL;
			}
		}
		else
		{
			FreeVec(dw);
			return NULL;
		}
	}

	if(dl_filename) ami_utf8_free(dl_filename);
	dw->size = total_size;
	dw->downloaded = 0;
	if(gui) dw->bw = gui->bw;
	dw->url = url;

	va[0] = (APTR)dw->downloaded;
	va[1] = (APTR)dw->size;
	va[2] = 0;

	if(!(dw->fh = FOpen((STRPTR)&dw->fname,MODE_NEWFILE,0)))
	{
		FreeVec(dw);
		return NULL;
	}

	dw->objects[OID_MAIN] = WindowObj,
      	    WA_ScreenTitle, ami_gui_get_screen_title(),
           	WA_Title, dw->url,
           	WA_Activate, TRUE,
           	WA_DepthGadget, TRUE,
           	WA_DragBar, TRUE,
           	WA_CloseGadget, FALSE,
           	WA_SizeGadget, TRUE,
			WA_PubScreen,scrn,
			WINDOW_SharedPort,sport,
			WINDOW_UserData,dw,
			WINDOW_IconifyGadget, FALSE,
			WINDOW_LockHeight,TRUE,
         	WINDOW_Position, WPOS_CENTERSCREEN,
           	WINDOW_ParentGroup, dw->objects[GID_MAIN] = LayoutVObj,
				LAYOUT_AddChild, dw->objects[GID_STATUS] = FuelGaugeObj,
					GA_ID,GID_STATUS,
					GA_Text,messages_get("amiDownload"),
					FUELGAUGE_Min,0,
					FUELGAUGE_Max,total_size,
					FUELGAUGE_Level,0,
					FUELGAUGE_Ticks,11,
					FUELGAUGE_ShortTicks,TRUE,
					FUELGAUGE_VarArgs,va,
					FUELGAUGE_Percent,FALSE,
					FUELGAUGE_Justification,FGJ_CENTER,
				FuelGaugeEnd,
				CHILD_NominalSize,TRUE,
				CHILD_WeightedHeight,0,
				LAYOUT_AddChild, dw->objects[GID_CANCEL] = ButtonObj,
					GA_ID,GID_CANCEL,
					GA_RelVerify,TRUE,
					GA_Text,messages_get("Abort"),
					GA_TabCycle,TRUE,
				ButtonEnd,
			EndGroup,
		EndWindow;

	dw->win = (struct Window *)RA_OpenWindow(dw->objects[OID_MAIN]);
	dw->ctx = ctx;

	dw->node = AddObject(window_list,AMINS_DLWINDOW);
	dw->node->objstruct = dw;

	downloads_in_progress++;

	return dw;
}
コード例 #30
0
/* Determine whether or not our target ES file is indeed valid input. */
ESStatus GetESStatus(char *filename)
{
    ESStatus result = ESStatus::Empty;

    // Read a temporary buffer of the entire file contents
    fseek(_fInput, 0, SEEK_END);
    size_t length = ftell(_fInput);
    char* temporaryBuffer = (char*)malloc(length);
    fseek(_fInput, 0, SEEK_SET);
    fread(temporaryBuffer, length, 1, _fInput);
    fclose(_fInput);

    // Loop through each line
    char* currentSequence = strtok(temporaryBuffer, "\n");

    // No newlines, but it might still be valid.
    if (!currentSequence)
        currentSequence = temporaryBuffer;

    bool inBlockComment = false;
    do
    {
        size_t sequenceLength = strlen(currentSequence);

        for (size_t iteration = 0; iteration < sequenceLength; iteration++)
        {
            // If we're still in a block comment, find the closing */
            if (inBlockComment)
            {
                char* blockClosing = strstr(currentSequence, "*/");
                if (!blockClosing)
                    break;
                else
                {
                    inBlockComment = false;
                    iteration = ((size_t)blockClosing - (size_t)currentSequence) + 2;
                }
            }

            // If we find a // sequence, simply skip this line
            if (currentSequence[iteration] == '/' && currentSequence[iteration + 1] == '/')
                break;

            // If we find a /* on this line but not a closing */, skip this line
            if (currentSequence[iteration] == '/' && currentSequence[iteration + 1] == '*')
            {
                // Is there a closing */ on this line?
                char* blockClosing = strstr(currentSequence, "*/");

                if (!blockClosing)
                {
                    inBlockComment = true;
                    break;
                }
                else
                {
                    iteration = ((size_t)blockClosing - (size_t)currentSequence) + 2;
                    inBlockComment = false;
                    continue;
                }
            }

            if (iteration >= sequenceLength)
                break;

            // If we got to this point, we should be able to read only a number on this line
            for (size_t checkIteration = 0; checkIteration < sequenceLength; checkIteration++)
                if (currentSequence[checkIteration] != '\n' && currentSequence[checkIteration] != 0x20 && !isdigit(currentSequence[checkIteration]))
                {
                    result = ESStatus::Error;
                    break;
                }
                else if (currentSequence[checkIteration] != '\n' && currentSequence[checkIteration] != 0x20)
                    result = ESStatus::Good;

            free(temporaryBuffer);
            if (result == ESStatus::Good)
                _fInput = FOpen(filename, "r");

            return result;
        }
    }
    while(currentSequence = strtok(NULL, "\n"));

    free(temporaryBuffer);
    if (result == ESStatus::Good)
        _fInput = FOpen(filename, "r");

    return result;
}