示例#1
0
文件: tool.cpp 项目: hfvw/wxExtension
wxExTool::wxExTool(int type)
  : m_Id(type)
{
  if (m_ToolInfo.empty())
  {
    AddInfo(ID_TOOL_REPORT_FIND, _("Found %d matches in"));
    AddInfo(ID_TOOL_REPORT_REPLACE, _("Replaced %d matches in"));
    AddInfo(ID_TOOL_REPORT_KEYWORD, _("Reported %d keywords in"), _("Report &Keyword"));
  }
}
void THISCLASS::OnStart() {
	bool production = mCore->IsStartedInProductionMode();

	// Read the file (if the filename changed or if we are in production mode)
	wxString filename_string = GetConfigurationString(wxT("File"), wxT(""));
	wxFileName filename = mCore->GetProjectFileName(filename_string);
	if (production || (mSimulationParticles == 0) || (mSimulationParticles->GetFileName() != filename)) {
		delete mSimulationParticles;
		mSimulationParticles = new SimulationParticles(filename);
		if (! mSimulationParticles->IsOpen()) {
			AddError(wxT("The file \'") + filename.GetFullPath() + wxT("\' could not be read."));
		} else {
			AddInfo(wxT("File \'") + mSimulationParticles->GetFileName().GetFullPath() + wxT("\' loaded."));
		}
	}

	// Load other values
	OnReloadConfiguration();

	// Start the simulation at the first frame that is available in the file
	SimulationParticles::Frame *frame = mSimulationParticles->FirstFrame();
	if (frame) {
		mFrameNumber = frame->number - 1;
	} else {
		mFrameNumber = 0;
	}

	// Data structure initialization
	mCore->mDataStructureInput.mFrameNumber = 0;
	mCore->mDataStructureParticles.mParticles = 0;
}
示例#3
0
Source Source::FromFile(boost::filesystem::path fname)
{
    return AddInfo(
        &FromFile_,
        [&](auto& e) { e << boost::errinfo_file_name{fname.string()}; },
        fname);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int AggregateCopyPropagation::ExtractCopySetInfo(CallInstr* instr, Operand*& destOp) {
    DebugValidator::IsNotNull(instr);

    // Check if we have a call to 'copyMemory' or
    // 'setMemory' that targets records or arrays.
    if(auto intrinsic = instr->GetIntrinsic()) {
        bool valid = false;
        bool isCopy;
        destOp = WithoutPointerCasts(CopyMemoryIntr::GetDestination(instr));

        if(intrinsic->Is<CopyMemoryIntr>()) {
            // The copy is valid only if the whole object
            // is copied using a constant size argument.
            auto destType = destOp->GetType()->As<PointerType>()->PointeeType();
            
            if(destType->IsRecord() || destType->IsArray()) {
                if(auto intConst = CopyMemoryIntr::GetLength(instr)->As<IntConstant>()) {
                    int size = TI::GetSize(destType, GetTarget());
                    valid = intConst->Value() == size;
                }
            }

            isCopy = true;
        }
        else if(intrinsic->Is<SetMemoryIntr>()) {
            // The copy is valid only if the whole object
            // is set using a constant size argument and a constant value.
            auto destType = destOp->GetType()->As<PointerType>()->PointeeType();

            if(destType->IsRecord() || destType->IsArray()) {
                if(auto intConst = SetMemoryIntr::GetLength(instr)->As<IntConstant>()) {
                    int size = TI::GetSize(destType, GetTarget());

                    // Check that the value that is set is a constant.
                    valid = (intConst->Value() == size) &&
                            (SetMemoryIntr::GetSource(instr)->IsIntConstant());
                }
            }

            isCopy = false;
        }

        if(valid) {
            return AddInfo(instr, isCopy);
        }
    }

    return -1;
}
示例#5
0
void __fastcall TfrmSpeedTest::Test(bool Decode)
{
  WaitCursor();
  for (int i = 0; i < memFiles->Lines->Count; i++)
    if (FileExists(memFiles->Lines->Strings[i]))
    {
      __int64 FStringLength;
      AnsiString S = StringFromFile(memFiles->Lines->Strings[i], FStringLength);
      Cardinal FStartTime = GetTickCount();
      if (Decode)
        SimpleXMLDecode(S, false);
      else
        SimpleXMLEncode(S);
      AddInfo(memFiles->Lines->Strings[i], Decode, FStringLength, GetTickCount() - FStartTime, sgResults->Cells[0][1] != "");
    }
}
示例#6
0
int InitGMServer()
{
	WSADATA WsaData;
	WORD Version;
	SOCKADDR_IN ServerAddr;
	Version = MAKEWORD(2, 2);
	if (WSAStartup(Version, &WsaData) != 0)
	{
		//printf("初始化失败:%d\n", WSAGetLastError());
		return 0;
	}
	ServerSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (ServerSock == INVALID_SOCKET)
	{
		//printf("创建监听套接字失败:%d\n", WSAGetLastError());
		WSACleanup();
		return 0;
	}

	ServerAddr.sin_family = AF_INET;
	ServerAddr.sin_port = htons(SERVERPORT);
	ServerAddr.sin_addr.S_un.S_addr = INADDR_ANY;

	if (::bind(ServerSock, (LPSOCKADDR)&ServerAddr, sizeof(ServerAddr)) == SOCKET_ERROR)
	{
		//printf("绑定失败:%d\n", WSAGetLastError());
		WSACleanup();
		return 0;
	}

	if (listen(ServerSock, 100) == SOCKET_ERROR)
	{
		//printf("监听失败:%d\n", WSAGetLastError());
		WSACleanup();
		return 0;
	}

	ListenEvent = WSACreateEvent();
	WSAEventSelect(ServerSock, ListenEvent, FD_ACCEPT | FD_CLOSE);
	InitializeCriticalSection(&g_cs);
	InitializeCriticalSection(&g_DataCs);
	AddInfo("初始化GM服务器成功...\r\n");
	return 1;
}
示例#7
0
bool
keymagic_driver::SetIcon(const std::string& path)
{
	char cwd[256],
	base_path[256];
	bool retVal = false;
	
	GetCurrentDir(cwd);
	FullPath(file.c_str(), base_path);
	for (int i = strlen(base_path); i > 0 &&
		 !(base_path[i] == '/' || base_path[i] == '\\'); --i) {
		base_path[i] = '\0';
	}
	SetCurrentDir(base_path);
	
	FILE * f = fopen(path.c_str(), "rb");
	
	SetCurrentDir(cwd);

	if (f  == 0) {
		std::cerr << "Error: Cannot open icon file '" << path.c_str() << "'" << std::endl;
		exit(1);
	}
	
	fseek(f, 0, SEEK_END);
	long s = ftell(f);
	fseek(f, 0, SEEK_SET);
	
	char * data = new char[s+1];
	
	int read = fread(data, 1, s, f);
	if (read == s) {
		AddInfo('icon', data, s);
		retVal = true;
	}

	
	fclose(f);
	delete[] data;	
	
	return retVal;
}
示例#8
0
void
main(void)
	
	{
	const tTypeList myArgTypes = {
						A_DEFLONG,					// Optional argument:	1. Multipilier
						A_DEFLONG,					//						2. Adder
						A_DEFLONG,					//						3. Modulo
						A_DEFLONG,					//						4. Seed
						A_NOTHING
						};
	
	LITTER_CHECKTIMEOUT(kClassName);
	
	LitterSetupClass(	kClassName,
						sizeof(objLili),			// Class object size
						LitterCalcOffset(objLili),	// Magic "Obex" Calculation
						(method) LiliNew,			// Instance creation function
						NIL,						// No custom deallocation function
						NIL,						// No UI function
						myArgTypes);				// See above

	// Messages
	LITTER_TIMEBOMB LitterAddBang	((method) LiliBang);
	LITTER_TIMEBOMB LitterAddInt	((method) LiliSeed);
	LitterAddMess1	((method) LiliSet,		"set",		A_LONG);
	LitterAddMess1	((method) LiliSet,		"seed",		A_LONG);
	LitterAddMess1	((method) LiliMul,		"in1",		A_LONG);
	LitterAddMess1	((method) LiliAdder,	"in2",		A_LONG);
	LitterAddMess1	((method) LiliMod,		"in3",		A_LONG);
	LitterAddMess2	((method) LiliTell,		"tell",		A_SYM, A_SYM);
	LitterAddMess0	((method) LiliTattle,	"tattle");
	LitterAddCant	((method) LiliTattle,	"dblclick");
	LitterAddCant	((method) LiliAssist,	"assist");
	
	AddInfo();
	
	//Initialize Litter Library
	LitterInit(kClassName, 0);
	
	}
示例#9
0
void CDownDlg::OnEditUpdate(WORD wID)
{
    if (IDC_EDIT_FILE == wID)
    {
        ClearInfo();

        TCHAR str[MAX_PATH];
        GetDlgItemText(IDC_EDIT_FILE, str, MAX_PATH);

        CPEAnalyzer pe;
        pe.Open(str);
        m_type = pe.GetSignature(m_pSign, m_pFile);

        BOOL bEnable = TRUE;
        switch (m_type)
        {
        case ErrorSign:
            {
                lstrcpy(str, _T("ERROR: 打开文件错误。\r\n"));
                bEnable = FALSE;
            }
            break;
        case NoSign:
            {
                lstrcpy(str, _T("ERROR: 无签名信息。\r\n"));
                bEnable = FALSE;
            }
            break;
        case CVSign:
            {
                wsprintf(str, _T("PDB 签名: %s\r\n"), m_pSign);
                EnableDlgItem(IDC_BTN_DOWNLOAD);
            }
            break;
        }

        EnableDlgItem(IDC_BTN_DOWNLOAD, bEnable);
        AddInfo(str);
    }
}
示例#10
0
void
main(void)
	
	{
	const tTypeList myArgTypes = {
						A_DEFLONG,		// Number of dice of trials		(Default: 1)
						A_DEFLONG,		// Number of faces per die		(Default: 6)
						A_DEFLONG,		// Seed						(Default: Zero -- autoseed)
						A_NOTHING
						};
	
	LITTER_CHECKTIMEOUT(kClassName);
	
	// Standard Max setup() call
	LitterSetupClass(	kClassName,
						sizeof(objDicey),		// Class object size
						LitterCalcOffset(objDicey),	// Magic "Obex" Calculation
						(method) DiceyNew,			// Instance creation function
						(method) DiceyFree,			// Custom deallocation function
						NIL,						// No menu function
						myArgTypes);				// See above
	

	// Messages
	LITTER_TIMEBOMB LitterAddBang	((method) DiceyBang);
	LitterAddMess1	((method) DiceyNDice,	"in1",		A_LONG);
	LitterAddMess1	((method) DiceyNFaces,	"in2",		A_LONG);
	LitterAddMess1	((method) DiceySeed,	"seed",		A_DEFLONG);
	LitterAddMess2	((method) DiceyTell,	"tell",		A_SYM, A_SYM);
	LitterAddMess0	((method) DiceyTattle,	"tattle");
	LitterAddCant	((method) DiceyTattle,	"dblclick");
	LitterAddCant	((method) DiceyAssist,	"assist");
	
	AddInfo();
	
	//Initialize Litter Library
	LitterInit(kClassName, 0);
	Taus88Init();
	
	}
int Preparation(int socket)
{
    int fileSize;
    char fileSizeStr[64] = {0};
    char fileName[256] = {0};
    FILE *wrfile;
    ConnectionInfo connectionInfo;



    if (ReceiveFileName(socket, fileName) < 1)
    {
        return -1;
    }
    send(socket, fileName, 1, 0);
    if (ReceiveFileSize(socket, fileSizeStr) < 1)
    {
        return -1;
    }
    send(socket, fileName, 1, 0);

    fileSize = atoi(fileSizeStr);
    printf("Receiving %s file, %s bytes...\n", fileName, fileSizeStr);
    wrfile = fopen(fileName, "w+");
    if (wrfile == NULL)
    {
        puts ("Error while opening file.");
        return -1;
    }
    connectionInfo.socket = socket;
    connectionInfo.wrfile = wrfile;
    connectionInfo.fileSize = fileSize;
    connectionInfo.totalBytesRead = 0;

    AddInfo (&info, connectionInfo);
    return 1;

}
示例#12
0
void
main(void)
	
	{
	const tTypeList myArgTypes = {
						A_DEFFLOAT,		// Optional arguments:	1. lamda
						A_DEFLONG,		// 						2. seed
										// If no seed specified, use global Taus88 data
						A_NOTHING
						};
	
	LITTER_CHECKTIMEOUT(kClassName);
	
	LitterSetupClass(	kClassName,
						sizeof(objPoisson),				// Class object size
						LitterCalcOffset(objPoisson),	// Magic "Obex" Calculation
						(method) PfishieNew,		// Instance creation function
						(method) PfishieFree,		// Custom deallocation function
						NIL,						// No menu function
						myArgTypes);				// See above
	
	// Messages
	LITTER_TIMEBOMB LitterAddBang	((method) PfishieBang);
	LitterAddMess1	((method) PfishieLambda,	"ft1",	A_FLOAT);
	LitterAddMess1	((method) PfishieSeed,		"seed",	A_DEFLONG);
	LitterAddMess2	((method) PfishieTell,		"tell",	A_SYM, A_SYM);
	LitterAddMess0	((method) PfishieTattle,	"tattle");
	LitterAddCant	((method) PfishieTattle,	"dblclick");
	LitterAddCant	((method) PfishieAssist,	"assist");
	
	AddInfo();
	
	//Initialize Litter Library
	LitterInit(kClassName, 0);
	Taus88Init();
	
	}
示例#13
0
Bool_t KVSimReader_ELIE::ReadHeader()
{
	// File header contains info on colliding nuclei
   // and number of simulated events:
   //
   // 54 129 50 119 32
   // 20000
   //
   // for 20000 events of 129Xe+119Sn@32MeV/nucleon
   
	Int_t res = ReadLineAndCheck(5," ");
	switch (res){
	case 0:
      Info("ReadHeader", "Can't read system");
		return kFALSE; 
	case 1:
		AddInfo("Aproj",GetReadPar(1));
		AddInfo("Zproj",GetReadPar(0));
		AddInfo("Atarg",GetReadPar(3));
		AddInfo("Ztarg",GetReadPar(2));
		AddInfo("Ebeam",GetReadPar(4));
      proj.SetZAandE(GetIntReadPar(0),GetIntReadPar(1),GetIntReadPar(1)*GetDoubleReadPar(4));
      targ.SetZandA(GetIntReadPar(2),GetIntReadPar(3));
      ebeam=GetDoubleReadPar(4);
		break;
	default:
		return kFALSE;	
	}
	
	res = ReadLineAndCheck(1," ");
	switch (res){
	case 0:
      Info("ReadHeader", "Can't read events");
		return kFALSE; 
	case 1:
		AddInfo("Nevents", GetReadPar(0));
      return kTRUE;
      
	default:
		return kFALSE;	
	}

	return kFALSE;	
}
示例#14
0
void LoopGMServer()
{

	HandleDataBuf(OnDispatchMessage);
	int nRet = WaitForSingleObject(ListenEvent, 100);
	if (nRet == WAIT_FAILED)
	{
		//printf("WaitForSingleObject Failed!\n");
		//break;
	}
	else if (nRet == WSA_WAIT_TIMEOUT)	//定时显示连接数
	{
		//printf("当前套接字连接数:%d\n", g_nCurrentConnections);
	}
	else	//有新的连接请求
	{
		ResetEvent(ListenEvent);
		while (true)
		{
			SOCKADDR_IN ClientAddr;
			int AddrLen = sizeof(ClientAddr);
			char sAct[64];
			SOCKET AcceptSock = accept(ServerSock, (LPSOCKADDR)&ClientAddr, &AddrLen);
			if (AcceptSock == SOCKET_ERROR)
			{
				break;
			}
			sprintf(sAct, "IP地址(%s)连接了区域服的GM服务\n", inet_ntoa(ClientAddr.sin_addr));
			AddInfo(sAct);
			LPSOCKET_OBJ pSockObj = CreateSocketObj(AcceptSock);
			pSockObj->m_clientaddr = ClientAddr;
			WSAEventSelect(pSockObj->m_socket, pSockObj->m_event, FD_READ | FD_WRITE | FD_CLOSE);
			AssignToFreeThread(pSockObj);
		}
	}
}
示例#15
0
void wxGISProcess::ProcessInput(wxString &sInputData)
{
	if(m_nState != enumGISTaskWork)
        return;
    sInputData = sInputData.Trim(true).Trim(false);

	wxString sRest;
	if( sInputData.StartsWith(wxT("DONE: "), &sRest) )
	{
        UpdatePercent(sRest.Trim(true).Trim(false).Truncate(sRest.Len() - 1));
		return;
	}
	if( sInputData.StartsWith(wxT("INFO: "), &sRest) )
	{
        AddInfo(enumGISMessageNorm, sRest);
		return;
	}
	if( sInputData.StartsWith(wxT("ERR: "), &sRest) )
	{
        AddInfo(enumGISMessageErr, sRest);
		return;
	}
	if( sInputData.StartsWith(wxT("WARN: "), &sRest) )
	{
        AddInfo(enumGISMessageWarning, sRest);
		return;
	}
	if( sInputData.StartsWith(wxT("SND: "), &sRest) )
	{
        AddInfo(enumGISMessageSend, sRest);
		return;
	}
	if( sInputData.StartsWith(wxT("RCV: "), &sRest) )
	{
        AddInfo(enumGISMessageReceive, sRest);
		return;
	}    
        
    AddInfo(enumGISMessageUnk, sInputData);
}
示例#16
0
文件: cl3.cpp 项目: u3shit/neptools
Cl3::Cl3(Source src)
{
    AddInfo(&Cl3::Parse_, ADD_SOURCE(src), this, src);
}
示例#17
0
void OptionParser::Run_(int& argc, const char** argv)
{
    argv0 = argv[0];
    int endp = 1;
    if (argc == 1)
    {
        if (no_opts_help)
        {
            ShowHelp();
            throw Exit{true};
        }
        else return;
    }

    std::array<Option*, 256> short_opts{};
    NEPTOOLS_STATIC_ASSERT(CHAR_BIT == 8);
    std::map<const char*, Option*, OptCmp> long_opts;

    for (auto g : groups)
        for (auto o : g->GetOptions())
        {
            if (!o->enabled) continue;
            if (o->short_name)
            {
                if (short_opts[static_cast<unsigned char>(o->short_name)])
                    NEPTOOLS_THROW(std::logic_error{"Duplicate short option"});
                short_opts[static_cast<unsigned char>(o->short_name)] = o;
            }

            auto x = long_opts.insert(std::make_pair(o->name, o));
            if (!x.second)
                NEPTOOLS_THROW(std::logic_error{"Duplicate long option"});
        }

    for (int i = 1; i < argc; ++i)
    {
        // option: "--"something, "-"something
        // non option: something, "-"
        // special: "--"

        // non option
        if (argv[i][0] != '-' || (argv[i][0] == '-' && argv[i][1] == '\0'))
        {
            if (no_arg_fun) no_arg_fun(argv[i]);
            else argv[endp++] = argv[i];
        }
        else
        {
            if (argv[i][1] != '-') // short
                i += ParseShort(short_opts, argc, i, argv);
            else if (argv[i][1] == '-' && argv[i][2] != '\0') // long
                i += AddInfo(std::bind(ParseLong, long_opts, argc, i, argv),
                             [=](auto& e) { e << ProcessedOption{argv[i]}; });
            else // --: end of args
            {
                if (no_arg_fun)
                    for (++i; i < argc; ++i)
                        no_arg_fun(argv[i]);
                else
                    for (++i; i < argc; ++i)
                        argv[endp++] = argv[i];
                break;
            }
        }
    }

    argc = endp;
    argv[argc] = nullptr;
}
示例#18
0
/*!
  \brief Get data blocks (&B)

  Call LoadData() before this function.

  \return FALSE on error
  \return TRUE on success
*/
int VFKReader::LoadDataBlocks()
{ 
    char         *pszChar;
    char         *pszLine;
    char         *pszBlockName;
    int           nRow;
    
    VFKDataBlock *poNewDataBlock;

    if (m_pszWholeText == NULL)
        return FALSE;

    poNewDataBlock = NULL;
    pszBlockName = NULL;
    nRow = 0;

    /* read lines */
    pszChar = m_pszWholeText;
    pszLine = m_pszWholeText;
    while (*pszChar != '\0') {
	if (*pszChar == '\r' && *(pszChar+1) == '\n') {
	    nRow++;
	    if (*pszLine == '&' && *(pszLine+1) == 'B') {
		/* add data block */
		pszBlockName = GetDataBlockName(pszLine);
                if (pszBlockName == NULL)
                    break;

		poNewDataBlock = new VFKDataBlock(pszBlockName, this);
		CPLFree(pszBlockName);
		pszBlockName = NULL;
		poNewDataBlock->SetGeometryType();
		poNewDataBlock->SetProperties(pszLine);
		AddDataBlock(poNewDataBlock);
	    }
	    else if (*pszLine == '&' && *(pszLine+1) == 'D') {
		/* data row */
		pszBlockName = GetDataBlockName(pszLine);
                if (pszBlockName == NULL)
                    break;

		poNewDataBlock = GetDataBlock(pszBlockName);
		if (poNewDataBlock == NULL) {
		    if (!EQUAL(pszBlockName, "KATUZE")) {
			/* ignore KATUZE block */
			CPLError(CE_Warning, CPLE_AppDefined, 
				 "Data block '%s' not found.\n", pszBlockName);
		    }
		}
		else 
		    poNewDataBlock->AddFeature(pszLine);

		CPLFree(pszBlockName);
		pszBlockName = NULL;
	    }
	    else if (*pszLine == '&' && *(pszLine+1) == 'H') {
		/* header - metadata */
		AddInfo(pszLine);
	    }
	    else if (*pszLine == '&' && *(pszLine+1) == 'K') {
		/* end of file */
		break;
	    }
	    pszChar++;
	    pszLine = pszChar + 1;
	}
	pszChar++;
    }

    return TRUE;
}
示例#19
0
CollectionLinkItem::CollectionLinkItem(
    Key k, Context* ctx, Source src, uint32_t count)
    : Item{k, ctx}
{
    AddInfo(&CollectionLinkItem::Parse_, ADD_SOURCE(src), this, src, count);
}
示例#20
0
int main (int argc, char *argv[])
{
 /*
  if(argc < 2)
  {
    printf("manque arg");
  }
  else
  {
    if(argc >= 3)
    {
    */
	  //deux argument:= 1er grey pour la fonction et le deuxième un nom d'image :appeler
        if((strcmp(argv[1],"grey"))==0)
        {
         /* SDL_Surface *surface=IMG_Load(argv[2]);
          goToGrey(surface);*/
	  example* arr;
	      image *tab = malloc(797*sizeof(image));
         arr=weightImage(tab, 797, 797);
	  float tab1[4]={-972.0,-1.0,0.222619,24.0};
	  float tab2[4]={3564.0,1.0,0.204066,24.0};
	  float tab3[4]={-1165.5,-1.0,0.198428,21.0};
	  float tab4[4]={1310.0,1.0,0.209290,20.0};
	  float tab5[4]={751.5,1.0,0.199548,9.0};
	  float tab6[4]={1190.0,1.0,0.204657,20.0};
	  float tab7[4]={8061.5,1.0,0.178388,23.0};
	  float tab8[4]={-504.0,-1.0,0.214318,16.0};
	  float tab9[4]={-4092.0,-1.0,0.170897,24.0};
	  float tab10[4]={-298.5,-1.0,0.178046,3.0};
	  float tab11[4]={6309.0,1.0,0.144317,18.0};
	  float tab12[4]={143.5,1.0,0.157750,7.0};
	  float tab13[4]={4826.0,1.0,0.248784,38.0};
	  float tab14[4]={-4212.0,-1.0,0.181252,24.0};
	  float tab15[4]={-1092.0,-1.0,0.191624,24.0};
	  float tab16[4]={8412.0,1.0,0.109095,24.0};
    float tab17[4]={112.5,1.0,0.104319,3.0};
	  float tab18[4]={-175.5,-1.0,0.166597,1.0};
	  float tab19[4]={4109.0,1.0,0.140488,42.0};
	  float tab20[4]={3173.0,1.0,0.158814,38.0};
	  float tab21[4]={1914.0,1.0,0.133727,12.0};
	  float tab22[4]={13.0,1.0,0.158362,2.0};
	  float tab23[4]={262.5,1.0,0.149735,5.0};
	  //evaluation prend en param: example *arr, int i(ieme image)
		// creer nb = nbligne dans fichier ,tab, lis dans le fichier et le remplis (avec serateurs...)
		// creer float = tab[4] * evaluate(tab, arr[i].feat[tab[3]])
	  for(int z=0;z<797;z++)
	  {float a=0.630079*evaluate(tab1,arr[z].feat[81095]);
	  float b=0.692751*evaluate(tab2,arr[z].feat[103319]);
	  float c=0.702541*evaluate(tab3,arr[z].feat[81556]);
	  float d=0.672720*evaluate(tab4,arr[z].feat[105231]);
	  float e=0.699813*evaluate(tab5,arr[z].feat[109008]);
	  float f=0.685823*evaluate(tab6,arr[z].feat[105342]);
	  float g=0.772684*evaluate(tab7,arr[z].feat[99628]);
	  float h=0.654340*evaluate(tab8,arr[z].feat[85502]);
	  float i=0.796683*evaluate(tab9,arr[z].feat[77819]);
	  float j=0.770885*evaluate(tab10,arr[z].feat[72880]);
	  float k=0.900025*evaluate(tab11,arr[z].feat[99926]);
	  float l=0.843853*evaluate(tab12,arr[z].feat[110235]);
	  float m=0.557756*evaluate(tab13,arr[z].feat[99462]);
	  float n=0.756812*evaluate(tab14,arr[z].feat[77819]);
          float o=0.726207*evaluate(tab15,arr[z].feat[77771]);
	  float p=1.068905*evaluate(tab16,arr[z].feat[99467]);
	  float q=1.084687*evaluate(tab17,arr[z].feat[110324]);
	  float r=0.804995*evaluate(tab18,arr[z].feat[72632]);
	  float s=0.915483*evaluate(tab19,arr[z].feat[95971]);
	  float t=0.840918*evaluate(tab20,arr[z].feat[99757]);
	  float u=0.943950*evaluate(tab21,arr[z].feat[106812]);
	  float v=0.840947*evaluate(tab22,arr[z].feat[110893]);
	  float w=0.881422*evaluate(tab23,arr[z].feat[108866]);

	  printf("%f\n",a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w);}
        }
   // 2 argument:= 1er integral pour la fonction et le deuxième un nom d'image:appeler
        if((strcmp(argv[1],"integral"))==0)
        {
          SDL_Surface *surface=IMG_Load(argv[2]);
         int **arr= Integral(surface);
	  printf("%d\n%d\n", getpixel(surface,0,0), getpixel(surface,0,1));
          printf("%d\n",arr[0][1]);		
        }
//2 argument:= 1er haar pour la fonction et le deuxième un nom d'image:appeler
        if((strcmp(argv[1],"haar"))==0)
        {
          /*SDL_Surface *surface=IMG_Load(argv[2]);
          feature *q=haarr2(surface);
	if(argc==4)
	  {printf("Le caractéristique %d vaut %d\n",atoi(argv[3]),(q[atoi(argv[3])]).res);}*/
						eval();
        }

//2 argument 1er decision 2eme entier i: appeler
         if((strcmp(argv[1],"decision"))==0)
        {
          example* arr;
	      image *tab = malloc(797*sizeof(image));
         arr=weightImage(tab, 797, 797);
	quickSort(arr,0,796,atoi(argv[2]));	
	     float *t=decision(arr,(atoi(argv[2])),796);
	
	printf("%f|",t[0]);
	printf("%f|",t[1]);
	printf("%f|",t[2]);
	printf("%f|",t[3]);
	printf("%f|",t[4]);
	printf("\n");
        }
//2 argument adaboost pour la fonction entier T pour le nombre de tour:appeler
      if((strcmp(argv[1],"adaboost"))==0)
      {
        example* arr;
	    image *tab = malloc(797*sizeof(image));
	    arr=weightImage(tab, 797, 797);	
	    adaboost(arr,atoi(argv[2]),320);
      }
   // if(argc == 2)
   // {
      //1 argument 1er image pour la fonction:appeler
        if((strcmp(argv[1],"image"))==0)
        {
          example* arr;
	      image *tab = malloc(797*sizeof(image));
	      arr=weightImage(tab, 797, 797);
        }

   /* }
      if(argc > 2)
      {
      */
        if(strcmp(argv[1], "bd") == 0)
        {
          CharacterInfo *c = NULL;
          c= ArrayData();
          char *a = "jerome", *b = "guillaume", *e= "valentin", *d = NULL;
          char **tab = malloc(4 * sizeof(a));
          tab[0] = a;
          tab[1] = b;
          tab[2] = e; 
          tab[3] = d;
          printf("enter\n\n\n"); 

          if(strcmp(argv[2],"-add")==0)
          {
            printf("addddddddddddddddddd!");
            c=AddInfo(c, argv[3]);
          }

          if(strcmp(argv[2],"-addBatch")==0)
          {
            c=AddBatch(c, tab);
          }

          if(strcmp(argv[2], "-remove")==0)
          {
            c=RemoveInfo(c, argv[3]);
          }

           if(strcmp(argv[2] , "-modif")==0)
          {
            ModifInfo(c, argv[3], argv[4]);
          }

          if(strcmp(argv[2], "-ls")==0)
          {
            ShowList(c);
          }
       /* }
      }
      else
    {
      printf("erreur arg");
    }
  }*/
  }
  return 0;
}
示例#21
0
void CDownDlg::OnBtnDownLoad(void)
{
    AddInfo(_T("开始下载..."));
    DWORD dwLen = lstrlen(m_pSign) + lstrlen(m_pFile) * 2 + 20;

    PTSTR lpURL = new TCHAR[dwLen];
    wsprintf(lpURL, _T("download/symbols/%s/%s/%s"), m_pFile, m_pSign, m_pFile);
    lpURL[dwLen - 2] = _T('_');

    // 获取目标文件路径
    TCHAR str[MAX_PATH];
    GetDlgItemText(IDC_EDIT_FILE, str, MAX_PATH);
    *(_tcsrchr(str, _T('\\')) + 1) = _T('\0');

    LFileDialog dlg(FALSE, _T("*.pdb\0*.pdb\0\0"), _T("*.pdb"));
    dlg.m_ofn->lpstrInitialDir = str;
    lstrcpy(dlg.m_szFileName, str);
    lstrcat(dlg.m_szFileName, m_pFile);
    if (!dlg.DoModal(m_hWnd))
    {
        AddInfo(_T("下载已取消。"));
        delete [] lpURL;
        return;
    }

    lstrcat(str, _T("download.tmp"));
    DOWNERROR ret = m_pDnLdr->DownLoadFile(_T("msdl.microsoft.com"),
        INTERNET_DEFAULT_HTTP_PORT, lpURL, str);
    switch (ret)
    {
    case DownOK:
        AddInfo(_T("下载完成。\r\n\r\n"));
        break;
    case DownDisconnected:
        AddInfo(_T("\r\nERROR: 无法连接服务器。\r\n\r\n"));
        break;
    case DownFileNotExists:
        AddInfo(_T("\r\nERROR: 远程文件不存在。\r\n\r\n"));
        break;
    case DownCannotOpenFile:
        AddInfo(_T("\r\nERROR: 无法创建本地文件。\r\n\r\n"));
        break;
    }

    if (DownOK != ret)
    {
        delete [] lpURL;
        return;
    }

    // 生成命令行
    LPTSTR lpCmd = new TCHAR[32 + lstrlen(str) + lstrlen(dlg.m_szFileName)];
    wsprintf(lpCmd, _T("expand.exe \"%s\" \"%s\""),
        str, dlg.m_szFileName);

    // 创建通信管道
    SECURITY_ATTRIBUTES sa;
    ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.bInheritHandle = TRUE;
    HANDLE hReadPipe, hWritePipe;
    CreatePipe(&hReadPipe, &hWritePipe, &sa, BUF_SIZE);

    // 创建目标进程
    STARTUPINFO sui;
    ZeroMemory(&sui, sizeof(STARTUPINFO));
    sui.cb = sizeof(STARTUPINFO);
    sui.dwFlags = STARTF_USESTDHANDLES;
    sui.hStdError = hWritePipe;
    sui.hStdOutput = hWritePipe;
    PROCESS_INFORMATION pi;
    if (CreateProcess(NULL, lpCmd, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL,
        &sui, &pi))
    {
        // 捕获所有进程输出
        DWORD dw;
        PSTR buf = new char[BUF_SIZE];
        ZeroMemory(buf, BUF_SIZE);
        ReadFile(hReadPipe, buf, BUF_SIZE, &dw, NULL);
        m_edtInfo.SetSelA(-1, -1);
        m_edtInfo.ReplaceSel(buf);
        delete [] buf;

        CloseHandle(pi.hThread);
        CloseHandle(pi.hProcess);

        // 删除 download.error 临时文件
        DeleteFile(str);
        EnableDlgItem(IDC_BTN_DOWNLOAD, FALSE);
    }
    else
    {
        AddInfo(_T("ERROR: 解压文件失败。\r\n\r\n"));
    }

    CloseHandle(hWritePipe);
    CloseHandle(hReadPipe);
    delete [] lpCmd;
    delete [] lpURL;
}
void SkDisplayType::BuildCondensedInfo(SkAnimateMaker* maker) {
    gInfos.setCount(kNumberOfTypes);
    memset(gInfos.begin(), 0, sizeof(gInfos[0]) * kNumberOfTypes);
    gInfosCounts.setCount(kNumberOfTypes);
    memset(gInfosCounts.begin(), -1, sizeof(gInfosCounts[0]) * kNumberOfTypes);
    // check to see if it is condensable
    int index, infoCount;
    for (index = 0; index < kTypeNamesSize; index++) {
        const SkMemberInfo* info = GetMembers(maker, gTypeNames[index].fType, &infoCount);
        if (info == NULL)
            continue;
        AddInfo(gTypeNames[index].fType, info, infoCount);
    }
    const SkMemberInfo* extraInfo =
        SkDisplayType::GetMembers(maker, SkType_3D_Point, &infoCount);
    AddInfo(SkType_Point, extraInfo, infoCount);
    AddInfo(SkType_3D_Point, extraInfo, infoCount);
//  int baseInfos = gInfos.count();
    do {
        SkTDMemberInfoArray oldRefs = gUnknowns;
        SkTDIntArray oldRefCounts = gUnknownsCounts;
        gUnknowns.reset();
        gUnknownsCounts.reset();
        for (index = 0; index < oldRefs.count(); index++) {
            const SkMemberInfo* info = oldRefs[index];
            if (gInfos.find(info) == -1) {
                int typeIndex = 0;
                for (; typeIndex < kNumberOfTypes; typeIndex++) {
                    const SkMemberInfo* temp = SkDisplayType::GetMembers(
                        maker, (SkDisplayTypes) typeIndex, NULL);
                    if (temp == info)
                        break;
                }
                SkASSERT(typeIndex < kNumberOfTypes);
                AddInfo((SkDisplayTypes) typeIndex, info, oldRefCounts[index]);
            }
        }
    } while (gUnknowns.count() > 0);
    qsort(gInfosTypeIDs.begin(), gInfosTypeIDs.count(), sizeof(gInfosTypeIDs[0]), &type_compare);
#ifdef SK_DEBUG
    FILE* condensed = fopen("../../src/animator/SkCondensedDebug.cpp", "w+");
    fprintf(condensed, "#include \"SkTypes.h\"\n");
    fprintf(condensed, "#ifdef SK_DEBUG\n");
#else
    FILE* condensed = fopen("../../src/animator/SkCondensedRelease.cpp", "w+");
    fprintf(condensed, "#include \"SkTypes.h\"\n");
    fprintf(condensed, "#ifdef SK_RELEASE\n");
#endif
    // write header
    fprintf(condensed, "// This file was automatically generated.\n");
    fprintf(condensed, "// To change it, edit the file with the matching debug info.\n");
    fprintf(condensed, "// Then execute SkDisplayType::BuildCondensedInfo() to "
        "regenerate this file.\n\n");
    // write name of memberInfo
    int typeNameIndex = 0;
    int unknown = 1;
    for (index = 0; index < gInfos.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        char scratch[64];
        bool drawPrefix, displayPrefix;
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
            drawPrefix = gTypeNames[typeNameIndex].fDrawPrefix;
            displayPrefix = gTypeNames[typeNameIndex].fDisplayPrefix;
        } else {
            sprintf(scratch, "Unknown%d", unknown++);
            drawPrefix = displayPrefix = false;
        }
        WriteInfo(condensed, info, gInfosCounts[index], scratch, drawPrefix, displayPrefix);
    }
    // write array of table pointers
//  start here;
    fprintf(condensed, "static const SkMemberInfo* const gInfoTables[] = {");
    typeNameIndex = 0;
    unknown = 1;
    for (index = 0; index < gInfos.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        char scratch[64];
        bool drawPrefix, displayPrefix;
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
            drawPrefix = gTypeNames[typeNameIndex].fDrawPrefix;
            displayPrefix = gTypeNames[typeNameIndex].fDisplayPrefix;
        } else {
            sprintf(scratch, "Unknown%d", unknown++);
            drawPrefix = displayPrefix = false;
        }
        fprintf(condensed, "\n\tg");
        if (drawPrefix)
            fprintf(condensed, "Draw");
        if (displayPrefix)
            fprintf(condensed, "Display");
        fprintf(condensed, "%sInfo", scratch);
        if (index < gInfos.count() - 1)
                putc(',', condensed);
    }
    fprintf(condensed, "\n};\n\n");
    // write the array of number of entries in the info table
    fprintf(condensed, "static const unsigned char gInfoCounts[] = {\n\t");
    int written = 0;
    for (index = 0; index < gInfosCounts.count(); index++) {
        int count = gInfosCounts[index];
        if (count < 0)
            continue;
        if (written > 0)
            putc(',', condensed);
        if (written % 20 == 19)
            fprintf(condensed, "\n\t");
        fprintf(condensed, "%d",count);
        written++;
    }
    fprintf(condensed, "\n};\n\n");
    // write array of type ids table entries correspond to
    fprintf(condensed, "static const unsigned char gTypeIDs[] = {\n\t");
    int typeIDCount = 0;
    typeNameIndex = 0;
    unknown = 1;
    for (index = 0; index < gInfosCounts.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        typeIDCount++;
        char scratch[64];
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
        } else
            sprintf(scratch, "Unknown%d", unknown++);
        fprintf(condensed, "%d%c // %s\n\t", index,
            index < gInfosCounts.count() ? ',' : ' ', scratch);
    }
    fprintf(condensed, "\n};\n\n");
    fprintf(condensed, "static const int kTypeIDs = %d;\n\n", typeIDCount);
    // write the array of string pointers
    fprintf(condensed, "static const char* const gInfoNames[] = {");
    typeNameIndex = 0;
    unknown = 1;
    written = 0;
    for (index = 0; index < gInfosCounts.count(); index++) {
        const SkMemberInfo* info = gInfos[index];
        if (info == NULL)
            continue;
        if (written > 0)
                putc(',', condensed);
        written++;
        fprintf(condensed, "\n\tg");
        char scratch[64];
        while (gTypeNames[typeNameIndex].fType < index)
            typeNameIndex++;
        if (gTypeNames[typeNameIndex].fType == index) {
            Get3DName(scratch, gTypeNames[typeNameIndex].fName);
        } else
            sprintf(scratch, "Unknown%d", unknown++);
        fprintf(condensed, "%sStrings", scratch);
    }
    fprintf(condensed, "\n};\n\n");
    fprintf(condensed, "#endif\n");
    fclose(condensed);
    gInfos.reset();
    gInfosCounts.reset();
    gInfosTypeIDs.reset();
    gUnknowns.reset();
    gUnknownsCounts.reset();
}
示例#23
0
	/** Adds one piece of information to assertion, generally a variable or result of function call.
     This function relies on conversion constructors in AssertInfo to create an AssertInfo from a
     single variable.
     */
	SmartAssert & operator ()( const AssertInfo & info )
	{
		return static_cast< SmartAssert & >( AddInfo( info ) );
	}