Exemplo n.º 1
0
void Stringify
     (
         const std::string &aNameInput,
         const std::string &aNameOutput,
         const std::string &aNameString
     )
{
   int aNbLigneTot=0;
   {
       FILE * aFIn = FopenNN(aNameInput,"rb","Stringify");

       int aC;
       while ((aC=fgetc(aFIn)) != EOF)
       {
          if (aC=='\n')
             aNbLigneTot++;
       }
       ElFclose(aFIn);
   }


   FILE * aFIn = FopenNN(aNameInput,"rb","Stringify");
   FILE * aFOut = FopenNN(aNameOutput,"wb","Stringify");

    //fprintf(aFOut,"%s","#include \"general/all.h\"");
    //fprintf(aFOut,"%s","#include \"private/all.h\"");
    //fprintf(aFOut,"%s",""");

   fprintf(aFOut,"#include \"StdAfx.h\"\n");

   
   fprintf(aFOut,"const char * (%s[%d]) = {\n",aNameString.c_str(),aNbLigneTot+2);

   fprintf(aFOut,"\"");
   int aC;
   while ((aC=fgetc(aFIn)) != EOF)
   {
       if (aC=='\n')
         fprintf(aFOut,"\\n\",\n\"");
       else if (aC=='"')
         fprintf(aFOut,"\\\"");
       else if (aC=='\\')
         fprintf(aFOut,"\\\\");
       else
         fputc(aC,aFOut);
   }
   fprintf(aFOut,"\",\"%s\"};\n",Terminator.c_str());


   ElFclose(aFIn);
   ElFclose(aFOut);
}
Exemplo n.º 2
0
void  cEl_GPAO::GenerateMakeFile(const std::string & aNameFile,bool ModeAdditif)  const
{
	//dump();
   // FILE * aFp = ElFopen(aNameFile.c_str(),ModeAdditif ? "a" : "w");
   FILE * aFp = FopenNN(aNameFile.c_str(),ModeAdditif ? "a" : "w","cEl_GPAO::GenerateMakeFile");
   for
   (
       std::map<std::string,cElTask *>::const_iterator iT=mDico.begin();
       iT!=mDico.end();
       iT++
   )
   {
        iT->second->GenerateMakeFile(aFp);
   }
   ElFclose(aFp);
}
Exemplo n.º 3
0
int ExportXmlGcp2Txt_main(int argc,char ** argv)
{
	std::string aFile, aDir, aOut="Output.txt";
	bool addInc = false;
	
	ElInitArgMain
    (
          argc, argv,
          LArgMain() << EAMC(aDir, "Directory")
					 << EAMC(aFile, "xml Gcps file",  eSAM_IsExistFile),
          LArgMain() << EAM(aOut,"Out",false,"output txt file name : def=Output.txt")
					 << EAM(addInc,"addInc",false,"export also uncertainty values : def=flase",eSAM_IsBool)
    );
    
    //read .xml file
    cDicoAppuisFlottant aDico = StdGetFromPCP(aFile,DicoAppuisFlottant);
	std::list<cOneAppuisDAF> aOneAppuisDAFList = aDico.OneAppuisDAF();
	
	//write data in .txt file
	if (!MMVisualMode)
	{
		FILE * aFP = FopenNN(aOut,"w","OrthoShifting_main");
		cElemAppliSetFile aEASF(aDir + ELISE_CAR_DIR + aOut);
		
		for (std::list<cOneAppuisDAF>::iterator itP=aOneAppuisDAFList.begin(); itP != aOneAppuisDAFList.end(); itP ++)
		{
			fprintf(aFP,"%s %.5f %.5f %.5f", itP->NamePt().c_str(), itP->Pt().x, itP->Pt().y, itP->Pt().z);
			
			if(addInc)
				fprintf(aFP,"%.5f %.5f %.5f\n", itP->Incertitude().x, itP->Incertitude().y, itP->Incertitude().z);
			else
				fprintf(aFP,"\n");
		}
		
		ElFclose(aFP);
	}
    
	return EXIT_SUCCESS;
}
Exemplo n.º 4
0
cGenerateMail::cGenerateMail(int argc,char ** argv) :
    mDir (MMDir() + "Documentation/Mailing/"),
    mICNM (cInterfChantierNameManipulateur::BasicAlloc(mDir)),
    mNameFile (mICNM->Get(".*\\.dcd")),
    mOnlyFile ("")
{
    mNbByF=298;
    ElInitArgMain
    (
        argc,argv,
        LArgMain() ,
        LArgMain() << EAM(mNbByF,"NbByF",true)
                   << EAM(mOnlyFile,"SingleFile",true,"If specified, all but this one will considered as black-list files")
                   << EAM(mDests,"Dests",true,"Selected dest (for ex [fr] if only french)")
    );	


    for (int aKN=0 ; aKN<int(mNameFile->size()) ; aKN++)
    {
        std::string aName = mDir + (*mNameFile)[aKN];
        std::cout << "========================= begin Name File :: " << aName << "\n";
        ParseFile(aName,false);
    }

    cCmpOEM TheCmp;
    std::sort(mVE.begin(),mVE.end(),TheCmp);

    FILE * aFP =0;
    int aCptF =0; 
    int aCptInF =0; 




    // std::string aSep=";";
    std::string aSep="";

    for (int aK=0 ; aK<int(mVE.size()) ; aK++)
    {
         if (aFP==0)
         {
              aFP = FopenNN(mDir+"MailList_"+ToString(aCptF)+".txt","w","MailList::open");
              fprintf(aFP,"[email protected]%s\n",aSep.c_str());

         }
         if (! mVE[aK]->mBlackList)
         {
             fprintf(aFP,"%s",mVE[aK]->mAdr.c_str());
             if ((aCptInF==mNbByF) || ((aK+1)==int(mVE.size())))
             {
                  fprintf(aFP,"\n");
                  fprintf(aFP,"[email protected]\n");
                  fclose(aFP);
                  aFP =0;
                  aCptF++;
                  aCptInF=0;
             }
             else
             {
                  aCptInF++;
                  fprintf(aFP,"%s\n",aSep.c_str());
             }
         }
    }
}
Exemplo n.º 5
0
void cGenerateMail::ParseFile(const std::string &aName,bool aTest)
{
    cOneEntryMail::mLastEntry=0;

    bool aBlackL = (NameWithoutDir(aName)=="Black-Liste.txt.dcd");
    if (mOnlyFile != "")
    {
         aBlackL = (NameWithoutDir(aName) != mOnlyFile);
    }

    if (aBlackL) 
    {
          std::cout <<   "     #######  BLACKLIST FILE ####\n";
    }
    std::string aNewName;

    decoder_force(aName.c_str(),aNewName);
    FILE * aFP = FopenNN(aNewName,"r","cGenerateMail::open");

    int aC;
    std::string anAdr;
    int aNbArr=0;
    while ((aC=fgetc(aFP)) != EOF)
    {
          if (aTest)
          {
               std::cout << char(aC) ;
          }
          bool aSep = IsMailSep(aC);
          bool aCar = IsMailCar(aC);

          if (aSep==aCar)
          {
               std::cout << "\n";
               std::cout << "in file " << aName << "\n";
               std::cout << " C= " << char(aC) << " I="  << int(aC) << "\n";
               fclose(aFP);
               coder_force(aNewName.c_str());
               ELISE_ASSERT(false,"Unexptecd char");
          }

          if (aSep)
          {
             if (aNbArr==1)
             {
                  cOneEntryMail  anEntr(anAdr,aBlackL);
                  if (! mDicE[anEntr.mId])  
                  {
                      mDicE[anEntr.mId] = new cOneEntryMail(anEntr);
                      if (
                            (anEntr.mOk)
                            && (aBlackL ||OkAdr(anEntr.mId) )
                         )
                      {
                         mVE.push_back(mDicE[anEntr.mId]);
                      }
                      else
                      {
                           std::cout << "ERR !! :: For File " << aName  << " For Name " << anAdr ;
                           if (cOneEntryMail::mLastEntry)
                              std::cout << " After " <<  cOneEntryMail::mLastEntry->mAdr;
                           else
                              std::cout << " (First of File)";
                           std::cout << "\n";
                      }
                      cOneEntryMail::mLastEntry = mDicE[anEntr.mId];
                  }
                  else
                  {
                      if (0)
                        std::cout << "Multiple " << anAdr << "\n";
                  }
                  if (anEntr.mBlackList)
                     mDicE[anEntr.mId]->mBlackList = true;
             }
             anAdr = "";
             aNbArr=0;
          }
          if (aCar)
          {
              anAdr += aC;
              if (aC=='@') 
                 aNbArr++;
          }
    }

    fclose(aFP);
    coder_force(aNewName.c_str());
}