您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ write_log函数代码示例

51自学网 2021-06-03 10:06:08
  C++
这篇教程C++ write_log函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中write_log函数的典型用法代码示例。如果您正苦于以下问题:C++ write_log函数的具体用法?C++ write_log怎么用?C++ write_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了write_log函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: expamem_wget

static uae_u32 REGPARAM2 expamem_wget (uaecptr addr){    uae_u32 v = (expamem_bget (addr) << 8) | expamem_bget (addr + 1);    write_log ("warning: READ.W from address $%lx=%04x PC=%x/n", addr, v & 0xffff, M68K_GETPC);    return v;}
开发者ID:voorhees1979,项目名称:PUAE,代码行数:6,


示例2: write_log

bool CSymbolEngineOpenPPLHandAndBoardExpression::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {	// First check, if hand$ or board$ and/or Suited	// At the same time remove the unnecessary parts of the expression	if (memcmp(name, "hand$", 5) == 0) {		is_hand_expression  = true;		is_board_expression = false;		hand_or_board_expression = name;		write_log(preferences.debug_hand_and_baord_expressions(), 			"[CSymbolEngineOpenPPLHandAndBoardExpression] Evaluating %s/n",			hand_or_board_expression);		hand_or_board_expression = CStringRemoveLeft(hand_or_board_expression, 5);		prime_coded_available_ranks = _prime_coded_hole_cards;	}	else if	(memcmp(name, "board$", 6) == 0) {		is_hand_expression  = false;		is_board_expression = true;		hand_or_board_expression = name;		write_log(preferences.debug_hand_and_baord_expressions(), 			"[CSymbolEngineOpenPPLHandAndBoardExpression] Evaluating %s/n",			hand_or_board_expression);		hand_or_board_expression = CStringRemoveLeft(hand_or_board_expression, 6);		prime_coded_available_ranks = _prime_coded_board_cards;	}	else {		// Quick exit on other symbols		return false;	}  write_log(preferences.debug_hand_and_baord_expressions(),     "[CSymbolEngineOpenPPLHandAndBoardExpression] Encoded available ranks> %i/n",    prime_coded_available_ranks);	bool is_suited_expression = false;	assert(is_hand_expression || is_board_expression);	if (hand_or_board_expression.Right(6).MakeLower() == "suited") {		write_log(preferences.debug_hand_and_baord_expressions(), 			"[CSymbolEngineOpenPPLHandAndBoardExpression] Suited expression/n");		is_suited_expression = true;		hand_or_board_expression = CStringRemoveRight(			hand_or_board_expression, 6);	}	// Checking ranks with potential multiplicity > 1, not caring about suits.	// We do this at the very beginning, as this is a very quick test	// and most real-world-use-cases will be false, so we get a fast exit.	int prime_coded_search_expression = PrimeCodedRanks(hand_or_board_expression);  write_log(preferences.debug_hand_and_baord_expressions(),     "[CSymbolEngineOpenPPLHandAndBoardExpression] Encoded searched ranks> %i/n",    prime_coded_available_ranks);	if ((prime_coded_available_ranks % prime_coded_search_expression) != 0)	{		// Division without reminder not possible.		// Therefore different primes in the search-expression		// Therefore ranks that do not fit available ranks.		write_log(preferences.debug_hand_and_baord_expressions(), 			"[CSymbolEngineOpenPPLHandAndBoardExpression] No match, because ranks do not fit/n");		*result = false;		return true;	}	// This was super-elegant, but unfortunatelly there can be 	// SUITED expressions, which we can only solve with srankbits.	// Ranks in the expression (to be searched)	if (is_suited_expression)	{		int rankbits_to_be_searched = CardStringToRankbits(((char*)hand_or_board_expression.GetString()));		write_log(preferences.debug_hand_and_baord_expressions(), 			"[CSymbolEngineOpenPPLHandAndBoardExpression] rank bits for %s = %i/n",			hand_or_board_expression.GetString(), rankbits_to_be_searched);		if (is_hand_expression)	{			// Suited hand-expression			// Ranks already checked, there are only 2, this simplifies things			if (!p_symbol_engine_cards->issuited()) {        write_log(preferences.debug_hand_and_baord_expressions(), 			    "[CSymbolEngineOpenPPLHandAndBoardExpression] No match, because off-suited hole-cards/n");				// No suited ranks available				*result = false;				return true;			}		}	else {			// Suited board-expression			int rankbits_available = p_symbol_engine_pokerval->srankbitscommon();				// Check ranks in expression against available ranks			if ((rankbits_to_be_searched & rankbits_available) != rankbits_to_be_searched)			{				write_log(preferences.debug_hand_and_baord_expressions(),					"[CSymbolEngineOpenPPLHandAndBoardExpression] No match, because suited rankbits do not fit/n");				*result = false;				return true;			}		}	}	// Third case: cards with individual suits	int length = hand_or_board_expression.GetLength();	for (int i=0; i<(length-1); i++) 	{		if (IsCardRankCharacter(hand_or_board_expression[i])			  && IsCardSuitCharacter(hand_or_board_expression[i+1])) {			CString card_with_specific_suit =				CString(hand_or_board_expression[i])				+ CString(hand_or_board_expression[i+1]);			int icard_with_specific_suit = CardStringToCardNumber(				((char*)card_with_specific_suit.GetString()));//.........这里部分代码省略.........
开发者ID:awptimus,项目名称:openholdembot,代码行数:101,


示例3: SQL_updateAttend_contest

void SQL_updateAttend_contest(int contestId,int verdictId,int problemId,char *num,char *username,time_t start_time,time_t end_time){	//已经AC的不需要修改attend	//update ac_time	long AC_time=0;	time_t first_ac_t;	SQL_SemP();	if(SQL_getFirstACTime_contest(contestId,problemId,username,first_ac_t,start_time,end_time))	{		AC_time=getdiftime(first_ac_t,start_time);	}	else	{		AC_time=0;		first_ac_t = end_time;	}	sprintf(query,"update attend set %s_time=%ld where contest_id=%d and username='%s';",num,AC_time,contestId,username);	//cout<<query<<endl;	if(mysql_real_query(mysql,query,(unsigned int)strlen(query)))	{		write_log(JUDGE_ERROR,mysql_error(mysql));	}	long ac_nCount=SQL_countProblemVerdict(contestId,problemId,V_AC,username);	int score_ = SQL_getContestScore(contestId,username,start_time,end_time);	string s_t,e_t,fAC_t;	API_TimeToString(s_t,start_time);	API_TimeToString(e_t,end_time);	API_TimeToString(fAC_t,first_ac_t);	//update score solved ,wrongsubmits	sprintf(query,"update attend set solved=(SELECT count(DISTINCT problem_id) FROM solution WHERE contest_id=%d and username='%s' and verdict=%d and submit_date between '%s' and '%s'),%s_wrongsubmits=(SELECT count(solution_id) FROM solution WHERE contest_id=%d and problem_id=%d and username='%s' and verdict>%d and submit_date between '%s' and '%s'),score=%d  where contest_id=%d and username='%s';",contestId,username,V_AC,s_t.c_str(),e_t.c_str(),   num,contestId,problemId,username,V_AC,s_t.c_str(),fAC_t.c_str(),  score_,  contestId,username);	if(mysql_real_query(mysql,query,(unsigned int)strlen(query)))	{		write_log(JUDGE_ERROR,mysql_error(mysql));	}	//penalty	int nCountProblems=SQL_countContestProblems(contestId);	char index='A';	long penalty=0;	for(int i=0;i<nCountProblems;i++)	{		long a_time_=0;		int wrongsubmits_=0;		SQL_getContestAttend(contestId,username,index+i,a_time_,wrongsubmits_);		if(a_time_>0)		{			penalty=penalty+a_time_+wrongsubmits_*60*20;		}	}	sprintf(query,"update attend set penalty=%ld where contest_id=%d and username='%s';",penalty,contestId,username);	if(mysql_real_query(mysql,query,(unsigned int)strlen(query)))	{		write_log(JUDGE_ERROR,mysql_error(mysql));	}	SQL_SemV();}
开发者ID:TomasCheng,项目名称:judge,代码行数:65,


示例4: my_stat

bool my_stat (const TCHAR *name, struct mystat *statbuf){	DWORD attr, ok;	FILETIME ft, lft;	HANDLE h;	BY_HANDLE_FILE_INFORMATION fi;	const TCHAR *namep;	bool fat;	TCHAR path[MAX_DPATH];	if (currprefs.win32_filesystem_mangle_reserved_names == false) {		_tcscpy (path, PATHPREFIX);		_tcscat (path, name);		namep = path;	} else {		namep = name;	}	// FILE_FLAG_BACKUP_SEMANTICS = can also "open" directories	h = CreateFile (namep, 0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL);	if (h == INVALID_HANDLE_VALUE)		return false;	fat = isfat (h);	ok = GetFileInformationByHandle (h, &fi);	CloseHandle (h);	attr = 0;	ft.dwHighDateTime = ft.dwLowDateTime = 0;	if (ok) {		attr = fi.dwFileAttributes;		if (fat) {			// fat lastwritetime only has 2 second resolution			// fat creationtime has 10ms resolution			// use creationtime if creationtime is inside lastwritetime 2s resolution			ULARGE_INTEGER ct, wt;			ct.HighPart = fi.ftCreationTime.dwHighDateTime;			ct.LowPart = fi.ftCreationTime.dwLowDateTime;			wt.HighPart = fi.ftLastWriteTime.dwHighDateTime;			wt.LowPart = fi.ftLastWriteTime.dwLowDateTime;			uae_u64 ctsec = ct.QuadPart / 10000000;			uae_u64 wtsec = wt.QuadPart / 10000000;			if (wtsec == ctsec || wtsec + 1 == ctsec) {				ft = fi.ftCreationTime;			} else {				ft = fi.ftLastAccessTime;			}		} else {			ft = fi.ftLastWriteTime;		}		statbuf->size = ((uae_u64)fi.nFileSizeHigh << 32) | fi.nFileSizeLow;	} else {		write_log (_T("GetFileInformationByHandle(%s) failed: %d/n"), namep, GetLastError ());		return false;	}	statbuf->mode = (attr & FILE_ATTRIBUTE_READONLY) ? FILEFLAG_READ : FILEFLAG_READ | FILEFLAG_WRITE;	if (attr & FILE_ATTRIBUTE_ARCHIVE)		statbuf->mode |= FILEFLAG_ARCHIVE;	if (attr & FILE_ATTRIBUTE_DIRECTORY)		statbuf->mode |= FILEFLAG_DIR;	FileTimeToLocalFileTime (&ft,&lft);	uae_u64 t = (*(__int64 *)&lft-((__int64)(369*365+89)*(__int64)(24*60*60)*(__int64)10000000));	statbuf->mtime.tv_sec = t / 10000000;	statbuf->mtime.tv_usec = (t / 10) % 1000000;	return true;}
开发者ID:engur,项目名称:WinUAE,代码行数:69,


示例5: load

//Function:     load//Description:  loads the key_count and property_count from the respective file//              loads the inventory table data from secondary memory to primary//Input param:  NULL//Return Type:  integer//              success status on successful operation//              respective error status code otherwiseint load(){    // Start the log file    open_log();    // Use a file pointer to open various files to load the values    FILE *fp;    //Local variables    int index       = 0;    int key_index   = 0;    int status      = 0;    int file_status = 0;    //check whether key_count.txt file is empty or not.    file_status = file_empty_check("key_count.txt");    if (file_status == 1006)        return FAILURE;    //check whether property_count.txt file is empty or not.    file_status = file_empty_check("property_count.txt");    if (file_status == 1006)        return FAILURE;    //check whether inventory_file.txt file is empty or not    file_status = file_empty_check("inventory_file.txt");    if (file_status == 1006)        return FAILURE;    // Open the key_count file to read the number of keywords    fp = fopen("key_count.txt","r");    if(fp == NULL) {        write_log("load", "FILE_OPEN_ERROR", "Unable to open the key_count file");        return FAILURE;    }    fscanf(fp,"%d", &key_count);    if(key_count <= 0 ) {        write_log("load", "FAILURE", "Key count is 0 or less than 0");        return FAILURE;    }    write_log("load", "SUCCESS", "Key count read successfully");    fclose(fp);    // Open the property_count file to read the number of properties    fp = fopen("property_count.txt","r");    if(fp == NULL) {        write_log("load", "FILE_OPEN_ERROR", "Unable to open the property_count file");        return FAILURE;    }    fscanf(fp,"%d", &property_count);    if (property_count <= 0) {        write_log("load", "FAILURE", "property count is 0 or less than 0");        return FAILURE;    }    write_log("load", "SUCCESS", "Property count read successfully");    fclose(fp);    // Open the inventory_file to read the available inventory details    fp = fopen("inventory_file.txt", "r");    if (fp == NULL) {        write_log("load", "FILE_OPEN_ERROR", "Error in opening the inventory_file");        return FAILURE;    }    // Allocate the memory for inventory table    status = inventory_memory_allocation();    if(status ==  1002) {        write_log("load", "MEMORY_ALLOCATION_ERROR", "No memory for inventory table");        return FAILURE;    }    // Load the details from file to main memory    while(!feof(fp)) {        for(index = 0; index <= key_count; index++) {            fscanf(fp, "%s ", inventory[key_index][index]);        }        key_index++;    }    fclose(fp);    write_log("load", "SUCCESS", "Inventory Load Successful");    return SUCCESS;}
开发者ID:prakashbh,项目名称:inventory-data-structure,代码行数:96,


示例6: main

int main(int argc, char *argv[]){    char* cmd;    if ((cmd = strrchr(argv[0],'/')) == NULL)    {        cmd = argv[0];    }    else        cmd++;    const char* server_name = "synctool";    char path[BUFSIZE];    char server_path[BUFSIZE];    memset(path,0,BUFSIZE);    memset(server_path,0,BUFSIZE);    getcwd(path,BUFSIZE);    strcat(path,"/");    memcpy(server_path,path,BUFSIZE);    strcat(server_path,server_name);    memcpy(log_name,path,BUFSIZE);    strcat(log_name,"daemon_log.txt");    char now_time[40];    get_time(now_time,40);    write_log("synctool daemon start time : %s/n",now_time);    /// 先判断守护进程是否已经运行    ///     if(just_running(LOCKDAEM,NULL) == 0)    {        printf("the sync_daemon is already running !/n");        return 0;    }    daemonize(cmd);    signal(SIGTERM,sigterm_handle);    /// 记录守护进程pid    if(record_pid(LOCKDAEM) != 0)    {        printf("sync_daemon write pid failed !/n");        return 0;    }    while(_running)    {        pid_t pid;        if((pid = fork()) < 0)        {            write_log("fork error !/n");        }        else if(pid == 0)        {            if(record_pid(LOCKFILE) == 0)            {                if(execl(server_path,server_name,path,(char*)0) < 0)                {                    write_log(strerror(errno));                    remove(LOCKFILE);                }            }        }        else        {            pid_t sub_pid = wait(NULL);            if (sub_pid != pid)            {                write_log("wait synctool pid (%d) not equal fork return pid(%d)! /n",sub_pid,pid);            }            remove(LOCKFILE);            write_log("restart synctool server !/n");        }    }    return 0;}
开发者ID:zhangxiangsong,项目名称:some_work,代码行数:78,


示例7: FAST_EXIT_ON_OPENPPL_SYMBOLS

bool CSymbolEnginePokerTracker::EvaluateSymbol(const char *name, double *result, bool log /* = false */){  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);	if (memcmp(name,"pt_",3)!=0)	{		// Symbol of a different symbol-engine		return false;	}	CString s = name;	CheckForChangedPlayersOncePerHeartbeatAndSymbolLookup();	if (IsOldStylePTSymbol(s))	{		CString error_message;		error_message.Format(			"Old style PokerTracker symbol detected: %s./n"			"/n"			"PokerTracker symbol start with /"pt_/"./n"      "Possible postfixes:/n"      "  * chair number (0..9)/n"      "  * _raischair/n"      "  * _headsup/n"      "  * _smallblind/n"      "  * _bigblind/n"      "  * _dealer/n"      "  * _cutoff/n"      "  * _user/n"      "  * _firstraiser/n"      "  * _firstcaller/n"      "  * _lastcaller/n", s);		OH_MessageBox_Formula_Error(			error_message,			 			"ERROR: Invalid PokerTracker Symbol");		*result = kUndefined;		return true;	}	if (!PT_DLL_IsValidSymbol(CString(s)))	{		// Invalid PokerTracker symbol		WarnAboutInvalidPTSymbol(s);		*result = kUndefined;		return true;	}	int chair = 0;	if (!p_pokertracker_thread->IsConnected()) 	{		if (!p_symbol_engine_userchair->userchair_confirmed() || p_formula_parser->IsParsing()) {			// We are not yet seated or formula is getting parsed.			// Symbol-lookup happens, because of Formula-validation.			// Not a problem, if we do not yet have a DB-connection.			// Don't throw a warning here.       write_log(preferences.debug_pokertracker(), "[PokerTracker] Not yet seated or formula parsing./n");		} else {			// We are seated and playing.			// Serious problem, if we do not have a DB-connection.			OH_MessageBox_Error_Warning("Not connected to PokerTracker database./n"				"Can't use PokerTracker symbols.");		}		*result = kUndefined;		return true;	}	CString standard_symbol_name;	assert(StringAIsPrefixOfStringB("pt_", s));	// PokerTracker symbols for the raise-chair	if (s.Right(10) == "_raischair") {		chair = p_symbol_engine_raisers->raischair();	}	// PokerTracker symbols for the opponent headsup chair	else if (s.Right(8) == "_headsup") {    chair = p_symbol_engine_chairs->opponent_headsup_chair();	}  // PokerTracker symbols for the smallblind chair	else if (s.Right(11) == "_smallblind") {    chair = p_symbol_engine_chairs->smallblind_chair();	}  // PokerTracker symbols for the bigblind chair	else if (s.Right(9) == "_bigblind") {    chair = p_symbol_engine_chairs->bigblind_chair();	}  // PokerTracker symbols for the cutoff chair	else if (s.Right(7) == "_cutoff") {    chair = p_symbol_engine_chairs->cutoff_chair();	}  // PokerTracker symbols for the firstcaller chair	else if (s.Right(12) == "_firstcaller") {    chair = p_symbol_engine_callers->firstcaller_chair();	}  // PokerTracker symbols for the lastcaller chair	else if (s.Right(11) == "_lastcaller") {    chair = p_symbol_engine_callers->lastcaller_chair();	}  // PokerTracker symbols for the firstraiser chair	else if (s.Right(12) == "_firstraiser") {		chair = p_symbol_engine_raisers->firstraiser_chair();	}  // PokerTracker symbols for the dealerchair chair	else if (s.Right(7) == "_dealer") {    chair = p_symbol_engine_dealerchair->dealerchair();	}  // PokerTracker symbols for the  chair//.........这里部分代码省略.........
开发者ID:BehnamEmamian,项目名称:openholdembot,代码行数:101,


示例8: write_log

void CTableLimits::CalcTableLimits(){	// This is basically the old function CSymbols::CalcStakes()	// with some extension at the end to auto-lock the blinds,	// if the values are reasonable.	write_log(3, "CTableLimits::CalcTableLimits()/n");	if (!IsCalculationNeccessary())	{		return;	}	SetSmallBlind(0);	SetBigBlind(0);	SetBigBet(0);	SetAnte(0);	// Save the parts we scraped successfully	if (p_scraper->s_limit_info()->found_sblind)		SetSmallBlind(p_scraper->s_limit_info()->sblind);								// sblind	if (p_scraper->s_limit_info()->found_bblind)		SetBigBlind(p_scraper->s_limit_info()->bblind);									// bblind	if (p_scraper->s_limit_info()->found_ante)		SetAnte(p_scraper->s_limit_info()->ante);										// ante	if (p_scraper->s_limit_info()->found_limit)		SetGametype(p_scraper->s_limit_info()->limit);									// lim	if (p_scraper->s_limit_info()->found_bbet)		SetBigBet(p_scraper->s_limit_info()->bbet);	_istournament = p_scraper->s_limit_info()->istournament;		write_log(3, "CTableLimits: input from scraper: small blind: %f/n", tablelimit_unreliable_input.sblind);	write_log(3, "CTableLimits: input from scraper: big blind:   %f/n", tablelimit_unreliable_input.bblind);	write_log(3, "CTableLimits: input from scraper: big bet:     %f/n", tablelimit_unreliable_input.bbet);	write_log(3, "CTableLimits: input from scraper: gametype:    %d/n", _gametype);             	// Figure out bb/sb based on game type	if (gametype() == k_gametype_NL || gametype() == k_gametype_PL)	{		CalcTableLimits_NL_PL();	}	else if (gametype() == k_gametype_FL || gametype() == k_gametype_unknown)	{		CalcTableLimits_FL_AndUnknownGametype();	}	// if we still do not have blinds, then infer them from the posted bets	if (p_betround_calculator->betround() == k_betround_preflop && (tablelimit_unreliable_input.sblind==0 || tablelimit_unreliable_input.bblind==0))	{		SearchTableForSbAndBbValue();				}	write_log(3, "CTableLimits: calculated result: small blind: %f/n", tablelimit_unreliable_input.sblind);	write_log(3, "CTableLimits: calculated result: big blind:   %f/n", tablelimit_unreliable_input.bblind);	write_log(3, "CTableLimits: calculated result: big bet:     %f/n", tablelimit_unreliable_input.bbet);	AdjustForReasonableness();	write_log(3, "CTableLimits: adjusted result: small blind: %f/n", tablelimit_unreliable_input.sblind);	write_log(3, "CTableLimits: adjusted result: big blind:   %f/n", tablelimit_unreliable_input.bblind);	write_log(3, "CTableLimits: adjusted result: big bet:     %f/n", tablelimit_unreliable_input.bbet);	AcceptNewValuesIfGood();	AutoLockBlinds();	// Calc miminum betsizes for every streeet (after! we have potentially locked the blinds)	CalcBetsizesForEveryStreet();}
开发者ID:ohzooboy,项目名称:oh,代码行数:61,


示例9: sampler_getsample

uae_u8 sampler_getsample (int channel){#if 0	int cur_pos;	static int cap_pos;	static float diffsample;#endif	static double doffset_offset;	HRESULT hr;	DWORD t;	void *p1, *p2;	DWORD len1, len2;	evt cycles;	int sample, samplecnt;	double doffset;	int offset;	if (!currprefs.sampler_stereo)		channel = 0;	if (!inited) {		DWORD pos;		if (!capture_init ()) {			capture_free ();			return 0;		}		inited = 1;		oldcycles = get_cycles ();		oldoffset = -1;		doffset_offset = 0;		hr = lpDSB2r->GetCurrentPosition (&t, &pos);		if (FAILED (hr)) {			sampler_free ();			return 0;		}				if (t >= pos)			safediff = t - pos;		else			safediff = recordbufferframes * SAMPLESIZE - pos + t;		write_log (_T("SAMPLER: safediff %d %d/n"), safediff, safediff + sampleframes * SAMPLESIZE);		safediff += 4 * sampleframes * SAMPLESIZE;#if 0		diffsample = 0;		safepos = -recordbufferframes / 10 * SAMPLESIZE;		hr = lpDSB2r->GetCurrentPosition (&t, &pos);		cap_pos = pos;		cap_pos += safepos;		if (cap_pos < 0)			cap_pos += recordbufferframes * SAMPLESIZE;		if (cap_pos >= recordbufferframes * SAMPLESIZE)			cap_pos -= recordbufferframes * SAMPLESIZE;		if (FAILED (hr)) {			sampler_free ();			return 0;		}#endif	}	if (clockspersample < 1)		return 0;	uae_s16 *sbuf = (uae_s16*)samplebuffer;	vsynccnt = 0;	sample = 0;	samplecnt = 0;	cycles = (int)get_cycles () - (int)oldcycles;	doffset = doffset_offset + cycles / clockspersample;	offset = (int)doffset;	if (oldoffset < 0 || offset >= sampleframes || offset < 0) {		if (offset >= sampleframes) {			doffset -= offset;			doffset_offset = doffset;		}		if (oldoffset >= 0 && offset >= sampleframes) {			while (oldoffset < sampleframes) {				sample += sbuf[oldoffset * SAMPLESIZE / 2 + channel];				oldoffset++;				samplecnt++;			}		}		hr = lpDSB2r->GetCurrentPosition (&t, NULL);		int pos = t;		pos -= safediff;		if (pos < 0)			pos += recordbufferframes * SAMPLESIZE;		hr = lpDSB2r->Lock (pos, sampleframes * SAMPLESIZE, &p1, &len1, &p2, &len2, 0);		if (FAILED (hr)) {			write_log (_T("SAMPLER: Lock() failed %x/n"), hr);			return 0;		}		memcpy (samplebuffer, p1, len1);		if (p2)			memcpy (samplebuffer + len1, p2, len2);		lpDSB2r->Unlock (p1, len1, p2, len2);#if 0		cap_pos = t;		cap_pos += sampleframes * SAMPLESIZE;		if (cap_pos < 0)			cap_pos += RECORDBUFFER * SAMPLESIZE;//.........这里部分代码省略.........
开发者ID:F1relight,项目名称:fs-uae-debian,代码行数:101,


示例10: GetDiskFreeSpaceEx

void CReplayFrame::CreateReplayFrame(void){	FILE			*fp = NULL;	int				i = 0;	time_t			ltime = 0;	tm				now_time = {0};	char			now_time_str[100] = {0};	ULARGE_INTEGER	free_bytes_for_user_on_disk = {0}, 					total_bytes_on_disk = {0}, 					free_bytes_total_on_disk = {0};	int				e = SUCCESS;	//  Sanity check: Enough disk-space for replay frame?		GetDiskFreeSpaceEx(		p_filenames->OpenHoldemDirectory(),  //  Directory on disk of interest		&free_bytes_for_user_on_disk,  		&total_bytes_on_disk,			&free_bytes_total_on_disk);	if (free_bytes_for_user_on_disk.QuadPart < FREE_SPACE_NEEDED_FOR_REPLAYFRAME) 	{		write_log(prefs.debug_replayframes(), "[CReplayFrame] Not enough disk-space/n");		OH_MessageBox_Error_Warning("Not enough disk space to create replay-frame.", "ERROR");		return;	}	// Get current time	time(&ltime);	localtime_s(&now_time, &ltime);	strftime(now_time_str, 100, "%Y-%m-%d %H:%M:%S", &now_time);	// Get exclusive access to CScraper and CSymbols variables	// (Wait for scrape/symbol cycle to finish before saving frame)	EnterCriticalSection(&p_heartbeat_thread->cs_update_in_progress);	CreateBitMapFile();	// Create HTML file	CString path = p_filenames->ReplayHTMLFilename(_next_replay_frame);	if (fopen_s(&fp, path.GetString(), "w")==0)	{		write_log(prefs.debug_replayframes(), "[CReplayFrame] Creating HTML file: $s/n", path);		// First line has to be the "title" of the table.		// This is no longer valid HTML, but the way Ray.E.Bornert did it		// for WinHoldem and WinScrape.		fprintf(fp, "%s/n", p_scraper->title());		// HTML header		fprintf(fp, "<html>/n");		fprintf(fp, "  <head>/n");		fprintf(fp, "    <title>%s</title>/n", p_scraper->title());		fprintf(fp, "  </head>");		fprintf(fp, "<style>/n");		fprintf(fp, "td {text-align:right;}/n");		fprintf(fp, "</style>/n");		fprintf(fp, "<body>/n");		fprintf(fp, "<font face=courier>/n");		// Bitmap image		fprintf(fp, "<img src=/"frame%06d.bmp/">/n", _next_replay_frame);		fprintf(fp, "<br>/n");		// Table title		fprintf(fp, "[%s]", p_scraper->title());		fprintf(fp, "<br>/n");		// Session, frame number and time		fprintf(fp, " [Session %lu]", p_sessioncounter->session_id());		fprintf(fp, " [Frame: %06d]", _next_replay_frame);		fprintf(fp, " [%s]<br>/n", now_time_str);		fprintf(fp, "<br>/n");		// Links forwards and backwards to the next frames		fprintf(fp, "%s", LPCSTR(GetLinksToPrevAndNextFile()));		fprintf(fp, "<br>/n");		fprintf(fp, "<br>/n");		// Header of main table for smaller data tables		fprintf(fp, "<table>/n");		fprintf(fp, "<tr>/n");		fprintf(fp, "<td>/n");		// Data tables		fprintf(fp, "%s", LPCSTR(GetPlayerInfoAsHTML()));		fprintf(fp, "/<td>/n");		fprintf(fp, "<td>/n");		fprintf(fp, "%s", LPCSTR(GetButtonStatesAsHTML()));		fprintf(fp, "%s", LPCSTR(GetBlindInfoAsHTML()));		fprintf(fp, "%s", LPCSTR(GetCommonCardsAsHTML()));		fprintf(fp, "%s", LPCSTR(GetPotsAsHTML()));		fprintf(fp, "</td>/n");		// Footer of main table		fprintf(fp, "</tr>/n");		fprintf(fp, "</table>/n");		// End of HTML		fprintf(fp, "</body></html>/n");		fclose(fp);	}	//.........这里部分代码省略.........
开发者ID:buranela,项目名称:OpenHoldemV12,代码行数:101,


示例11: th_uptime

/* * Uptime thread... */void *th_uptime(void *arg){   int ret,n;   struct timeval timeout;   sigset_t mask;write_log(0,"/n th_uptime thread = %d/n",(int)pthread_self());   sigfillset(&mask);   if (pthread_sigmask(SIG_BLOCK, &mask, NULL))   {      thread_error("th_uptime pthread_sigmask()",errno);      th_uptime_exit();   }   if (pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL))   {      thread_error("th_uptime pthread_setcancelstate()",errno);      th_uptime_exit();   }   pthread_cleanup_push( &th_uptime_clean, (void *)NULL );      if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL))   {      thread_error("th_uptime pthread_setcancelstate()",errno);      th_uptime_exit();   }   if (pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL))   {      n=errno;      pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);      thread_error("th_uptime pthread_setcanceltype()",n);      th_uptime_exit();   }   while(1)   {      timeout.tv_sec  = 1;      timeout.tv_usec = 0;      if ( (ret=select( 0, NULL, NULL, NULL, &timeout ) ) == -1 )      {         n=errno;         thread_error("th_uptime select()",n);         continue;      }      if ( !ret )  /* Timeout, update uptime... */         uptime++;    }   pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);            pthread_cleanup_pop(0);   return (NULL);}
开发者ID:ATouhou,项目名称:security-courses,代码行数:64,


示例12: doloop

/* * David, pon algo coherente!!! */voiddoloop(struct term_node *node, int mode){    struct term_tty *term_tty;    struct attack *theattack = NULL;    struct timeval timeout;    fd_set read_set;    int ret, fail;    struct termios old_term, term;        term_tty = node->specific;    theattack = protocols[mode].attacks;    if (term_tty->attack >= 0)     {        if (theattack[term_tty->attack].nparams)        {            printf("/n<*> Ouch!! At the moment the command line interface doesn't support attacks <*>/n");            printf("<*> that needs parameters and the one you've choosed needs %d <*>/n",                         theattack[term_tty->attack].nparams);        }        else        {            printf("<*> Starting %s attack %s.../n",                 (theattack[term_tty->attack].type)?"DOS":"NONDOS",                theattack[term_tty->attack].s);             if (attack_launch(node, mode, term_tty->attack, NULL, 0) < 0)                write_log(1, "Error launching attack %d (mode %d)!!/n",                             term_tty->attack, mode);            fflush(stdin); fflush(stdout);            setvbuf(stdout, NULL, _IONBF, 0);            tcgetattr(0,&old_term);            tcgetattr(0,&term);            term.c_cc[VMIN]  = 1;            term.c_cc[VTIME] = _POSIX_VDISABLE;            term.c_lflag &= ~ICANON;            term.c_lflag &= ~ECHO;            tcsetattr(0,TCSANOW,&term);            if (theattack[term_tty->attack].single == CONTINOUS) {                printf("<*> Press any key to stop the attack <*>/n");                fail = 0;                while(!fail && !node->thread.stop)                {                    FD_ZERO(&read_set);                    FD_SET(0, &read_set);                    timeout.tv_sec  = 0;                    timeout.tv_usec = 200000;                    if ( (ret=select(1, &read_set, NULL, NULL, &timeout) ) == -1 )                    {                       thread_error("network_peer_th select()",errno);                       continue;                    }                    if ( !ret )  /* Timeout, decrement timers... */                       continue;                    else                    {                       if (FD_ISSET(0, &read_set))                       {                          getchar();                          fail = 1;                       }                    }                 }             } else                /* Command line, only one attack (0), let's wait for its conclusion... */                while (node->protocol[mode].attacks[0].up)                    thread_usleep(150000);                          tcsetattr(0,TCSANOW, &old_term);        }             } /* if term_tty->attack */}
开发者ID:ATouhou,项目名称:security-courses,代码行数:80,


示例13: th_tty_peer

/* * Thread for handling command line attacks (TERM_TTY) * Use global variable struct term_tty *tty_tmp */void *th_tty_peer(void *args){   int fail;   time_t this_time;   struct cl_args *arguments;   struct term_tty *tty;   struct term_node *term_node=NULL;   sigset_t mask;      terms->work_state = RUNNING;   write_log(0, "/n th_tty_peer thread = %d.../n",(int)pthread_self());      sigfillset(&mask);      if (pthread_sigmask(SIG_BLOCK, &mask,NULL))   {      thread_error("th_tty_peer pthread_sigmask()",errno);      th_tty_peer_exit(NULL);   }      if (pthread_mutex_lock(&terms->mutex) != 0)   {      thread_error("th_tty_peer pthread_mutex_lock",errno);      th_tty_peer_exit(NULL);   }      fail = term_add_node(&term_node, TERM_TTY, (int)NULL, pthread_self());   if (fail == -1)   {      if (pthread_mutex_unlock(&terms->mutex) != 0)         thread_error("th_tty_peer pthread_mutex_unlock",errno);      th_tty_peer_exit(term_node);   }   if (term_node == NULL)   {      write_log(1,"Ouch!! No more than %d %s accepted!!/n",                  term_type[TERM_TTY].max, term_type[TERM_TTY].name);            if (pthread_mutex_unlock(&terms->mutex) != 0)         thread_error("th_tty_peer pthread_mutex_unlock",errno);      th_tty_peer_exit(term_node);   }   tty = term_node->specific;   memcpy(tty,tty_tmp,sizeof(struct term_tty));        this_time = time(NULL);   #ifdef HAVE_CTIME_R#ifdef SOLARIS    ctime_r(&this_time,term_node->since, sizeof(term_node->since));#else    ctime_r(&this_time,term_node->since);#endif#else    pthread_mutex_lock(&mutex_ctime);    strncpy(term_node->since, ctime(&this_time), sizeof(term_node->since));       pthread_mutex_unlock(&mutex_ctime);#endif    /* Just to remove the cr+lf...*/    term_node->since[sizeof(term_node->since)-2] = 0;    /* This is a tty so, man... ;) */    strncpy(term_node->from_ip, "127.0.0.1", sizeof(term_node->from_ip));   /* Parse config file */   if (strlen(tty_tmp->config_file))      if (parser_read_config_file(tty_tmp, term_node) < 0)      {         write_log(0, "Error reading configuration file/n");         th_tty_peer_exit(term_node);      }       if (init_attribs(term_node) < 0)            {       if (pthread_mutex_unlock(&terms->mutex) != 0)         thread_error("th_tty_peer pthread_mutex_unlock",errno);       th_tty_peer_exit(term_node);    }    arguments = args;        /* In command line mode we initialize the values by default */    if (protocols[arguments->proto_index].init_attribs)    {        fail = (*protocols[arguments->proto_index].init_attribs)            (term_node);    } else        write_log(0, "Warning, proto %d has no init_attribs function!!/n", arguments->proto_index);//.........这里部分代码省略.........
开发者ID:ATouhou,项目名称:security-courses,代码行数:101,


示例14: amiga_clipboard_proc_start

uae_u32 amiga_clipboard_proc_start (void){	write_log ("clipboard process init: %08x/n", clipboard_data);	signaling = 1;	return clipboard_data;}
开发者ID:ezgranny420,项目名称:PUAE,代码行数:6,


示例15: Process_Track

static USHORT Process_Track(struct zfile *fi, struct zfile *fo, UCHAR *b1, UCHAR *b2, USHORT cmd, USHORT opt, int32_t dmsflags, struct zfile **extra){	USHORT hcrc, dcrc, usum, number, pklen1, pklen2, unpklen, l;	UCHAR cmode, flags;	int32_t crcerr = 0;	l = (USHORT)zfile_fread(b1,1,THLEN,fi);	if (l != THLEN) {		if (l==0)			return DMS_FILE_END;		else			return ERR_SREAD;	}	/*  "TR" identifies a Track Header  */	if ((b1[0] != 'T')||(b1[1] != 'R')) return ERR_NOTTRACK;	/*  Track Header CRC  */	hcrc = (USHORT)((b1[THLEN-2] << 8) | b1[THLEN-1]);	if (dms_CreateCRC(b1,(ULONG)(THLEN-2)) != hcrc) return ERR_THCRC;	number = (USHORT)((b1[2] << 8) | b1[3]);	/*  Number of track  */	pklen1 = (USHORT)((b1[6] << 8) | b1[7]);	/*  Length of packed track data as in archive  */	pklen2 = (USHORT)((b1[8] << 8) | b1[9]);	/*  Length of data after first unpacking  */	unpklen = (USHORT)((b1[10] << 8) | b1[11]);	/*  Length of data after subsequent rle unpacking */	flags = b1[12];		/*  control flags  */	cmode = b1[13];		/*  compression mode used  */	usum = (USHORT)((b1[14] << 8) | b1[15]);	/*  Track Data CheckSum AFTER unpacking  */	dcrc = (USHORT)((b1[16] << 8) | b1[17]);	/*  Track Data CRC BEFORE unpacking  */	if (dolog)		write_log ("DMS: track=%d/n", number);	if (dolog) {		if (number==80)			write_log (" FileID   ");		else if (number==0xffff)			write_log (" Banner   ");		else if ((number==0) && (unpklen==1024))			write_log (" FakeBB   ");		else			write_log ("   %2d     ",(short)number);	    write_log ("%5d    %5d   %s  %04X  %04X  %04X    %0d/n", pklen1, unpklen, modes[cmode], usum, hcrc, dcrc, flags);	}	if ((pklen1 > TRACK_BUFFER_LEN) || (pklen2 >TRACK_BUFFER_LEN) || (unpklen > TRACK_BUFFER_LEN)) return ERR_BIGTRACK;	if (zfile_fread(b1,1,(size_t)pklen1,fi) != pklen1) return ERR_SREAD;	if (dms_CreateCRC(b1,(ULONG)pklen1) != dcrc) {		log_error (number);		crcerr = 1;	}	/*  track 80 is FILEID.DIZ, track 0xffff (-1) is Banner  */	/*  and track 0 with 1024 bytes only is a fake boot block with more advertising */	/*  FILE_ID.DIZ is never encrypted  */	//if (pwd && (number!=80)) dms_decrypt(b1,pklen1);	if ((cmd == CMD_UNPACK) && (number<80) && (unpklen>2048)) {		memset(b2, 0, unpklen);		if (!crcerr)			Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);		if (number == 0 && zfile_ftell (fo) == 512 * 22) {			// did we have another cylinder 0 already?			uint8_t *p;			zfile_fseek (fo, 0, SEEK_SET);			p = xcalloc (uint8_t, 512 * 22);			zfile_fread (p, 512 * 22, 1, fo);			addextra("BigFakeBootBlock", extra, p, 512 * 22);			xfree (p);		}		zfile_fseek (fo, number * 512 * 22 * ((dmsflags & DMSFLAG_HD) ? 2 : 1), SEEK_SET);		if (zfile_fwrite(b2,1,(size_t)unpklen,fo) != unpklen)			return ERR_CANTWRITE;	} else if (number == 0 && unpklen == 1024) {		memset(b2, 0, unpklen);		if (!crcerr)			Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);		addextra("FakeBootBlock", extra, b2, unpklen);	}	if (crcerr)		return NO_PROBLEM;	if (number == 0xffff && extra){		Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);		addextra("Banner", extra, b2, unpklen);		printbandiz(b2,unpklen);	}	if (number == 80 && extra) {		Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);		addextra("FILEID.DIZ", extra, b2, unpklen);		printbandiz(b2,unpklen);	}//.........这里部分代码省略.........
开发者ID:Yamakuzure,项目名称:PUAE,代码行数:101,


示例16: vsync_switchmode

int vsync_switchmode (int hz, int oldhz){	static int tempvsync;	int w = currentmode->native_width;	int h = currentmode->native_height;	int d = currentmode->native_depth / 8;//        struct MultiDisplay *md = getdisplay (&currprefs);	struct PicassoResolution *found;	int newh, i, cnt;	int dbl = getvsyncrate (currprefs.chipset_refreshrate) != currprefs.chipset_refreshrate ? 2 : 1;	if (hz < 0)		return tempvsync;	newh = h * oldhz / hz;	hz = hz * dbl;	found = NULL;        /*	for (i = 0; md->DisplayModes[i].depth >= 0 && !found; i++) {		struct PicassoResolution *r = &md->DisplayModes[i];		if (r->res.width == w && r->res.height == h && r->depth == d) {			int j;			for (j = 0; r->refresh[j] > 0; j++) {				if (r->refresh[j] == oldhz) {					found = r;					break;				}			}		}	}*/	if (found == NULL) {		write_log ("refresh rate changed to %d but original rate was not found/n", hz);		return 0;	}	found = NULL;/*        for (cnt = 0; cnt <= abs (newh - h) + 1 && !found; cnt++) {                for (i = 0; md->DisplayModes[i].depth >= 0 && !found; i++) {                        struct PicassoResolution *r = &md->DisplayModes[i];                        if (r->res.width == w && (r->res.height == newh + cnt || r->res.height == newh - cnt) && r->depth == d) {                                int j;                                for (j = 0; r->refresh[j] > 0; j++) {                                        if (r->refresh[j] == hz) {                                                found = r;                                                break;                                        }                                }                        }                }        }*/        if (!found) {                tempvsync = currprefs.gfx_avsync;                changed_prefs.gfx_avsync = 0;                write_log ("refresh rate changed to %d but no matching screenmode found, vsync disabled/n", hz);        } else {                newh = found->res.height;                changed_prefs.gfx_size_fs.height = newh;                changed_prefs.gfx_refreshrate = hz;                write_log ("refresh rate changed to %d, new screenmode %dx%d/n", hz, w, newh);        }/*        reopen (1);*/        return 0;}
开发者ID:ezgranny420,项目名称:PUAE,代码行数:67,


示例17: log_error

static void log_error(int32_t track){	write_log ("DMS: Ignored error on track %d!/n", track);}
开发者ID:Yamakuzure,项目名称:PUAE,代码行数:4,


示例18: write_log

void CMainFrame::OnEditTagLog() {	 write_log(k_always_log_basic_information,		"[*** ATTENTION ***] User tagged this situation for review/n");}
开发者ID:BehnamEmamian,项目名称:openholdembot,代码行数:4,


示例19: DMS_Process_File

USHORT DMS_Process_File(struct zfile *fi, struct zfile *fo, USHORT cmd, USHORT opt, USHORT PCRC, USHORT pwd, int32_t part, struct zfile **extra){	USHORT from, to, geninfo, c_version, cmode, hcrc, disktype, pv, ret;	ULONG pkfsize, unpkfsize;	UCHAR *b1, *b2;	time_t date;	passfound = 0;	passretries = 2;	b1 = xcalloc(UCHAR,TRACK_BUFFER_LEN);	if (!b1) return ERR_NOMEMORY;	b2 = xcalloc(UCHAR,TRACK_BUFFER_LEN);	if (!b2) {		xfree(b1);		return ERR_NOMEMORY;	}	dms_text = xcalloc(UCHAR,TEMP_BUFFER_LEN);	if (!dms_text) {		xfree(b1);		xfree(b2);		return ERR_NOMEMORY;	}	/* if iname is NULL, input is stdin;   if oname is NULL, output is stdout */	if (zfile_fread(b1,1,HEADLEN,fi) != HEADLEN) {		xfree(b1);		xfree(b2);		xfree(dms_text);		return ERR_SREAD;	}	if ( (b1[0] != 'D') || (b1[1] != 'M') || (b1[2] != 'S') || (b1[3] != '!') ) {		/*  Check the first 4 bytes of file to see if it is "DMS!"  */		xfree(b1);		xfree(b2);		xfree(dms_text);		return ERR_NOTDMS;	}	hcrc = (USHORT)((b1[HEADLEN-2]<<8) | b1[HEADLEN-1]);	/* Header CRC */	if (hcrc != dms_CreateCRC(b1+4,(ULONG)(HEADLEN-6))) {		xfree(b1);		xfree(b2);		xfree(dms_text);		return ERR_HCRC;	}	geninfo = (USHORT) ((b1[10]<<8) | b1[11]);	/* General info about archive */	date = (time_t) ((((ULONG)b1[12])<<24) | (((ULONG)b1[13])<<16) | (((ULONG)b1[14])<<8) | (ULONG)b1[15]);	/* date in standard UNIX/ANSI format */	from = (USHORT) ((b1[16]<<8) | b1[17]);		/*  Lowest track in archive. May be incorrect if archive is "appended" */	to = (USHORT) ((b1[18]<<8) | b1[19]);		/*  Highest track in archive. May be incorrect if archive is "appended" */	if (part && from < 30) {		xfree(b1);		xfree(b2);		xfree(dms_text);		return DMS_FILE_END;	}	pkfsize = (ULONG) ((((ULONG)b1[21])<<16) | (((ULONG)b1[22])<<8) | (ULONG)b1[23]);	/*  Length of total packed data as in archive   */	unpkfsize = (ULONG) ((((ULONG)b1[25])<<16) | (((ULONG)b1[26])<<8) | (ULONG)b1[27]);	/*  Length of unpacked data. Usually 901120 bytes  */	c_version = (USHORT) ((b1[46]<<8) | b1[47]);	/*  version of DMS used to generate it  */	disktype = (USHORT) ((b1[50]<<8) | b1[51]);		/*  Type of compressed disk  */	cmode = (USHORT) ((b1[52]<<8) | b1[53]);        /*  Compression mode mostly used in this archive  */	PWDCRC = PCRC;	if (dolog) {		pv = (USHORT)(c_version/100);		write_log (" Created with DMS version %d.%02d ",pv,c_version-pv*100);		if (geninfo & 0x80)			write_log ("Registered/n");		else			write_log ("Evaluation/n");		write_log (" Creation date : %s",ctime(&date));		write_log (" Lowest track in archive : %d/n",from);		write_log (" Highest track in archive : %d/n",to);		write_log (" Packed data size : %lu/n",pkfsize);		write_log (" Unpacked data size : %lu/n",unpkfsize);		write_log (" Disk type of archive : ");		/*  The original DMS from SDS software (DMS up to 1.11) used other values    */		/*  in disk type to indicate formats as MS-DOS, AMax and Mac, but it was     */		/*  not suported for compression. It was for future expansion and was never  */		/*  used. The newer versions of DMS made by ParCon Software changed it to    */		/*  add support for new Amiga disk types.                                    */		switch (disktype) {			case 0:			case 1:				/* Can also be a non-dos disk */				write_log ("AmigaOS 1.0 OFS/n");				break;			case 2:				write_log ("AmigaOS 2.0 FFS/n");//.........这里部分代码省略.........
开发者ID:Yamakuzure,项目名称:PUAE,代码行数:101,


示例20: CheckBringKeyboard

void CheckBringKeyboard(void) {	HMENU			bringsysmenu = NULL;	MENUITEMINFO	mii;	int				input_count = 0, i = 0;	INPUT			input[100] = {0};	char			temp[256] = {0};	CString			c_text = "";	int				keybd_item_pos = 0;	int				e = SUCCESS;	if (!p_symbol_engine_autoplayer->isbring())	{		write_log(preferences.debug_autoplayer(), "[BringKeyBoard] Not connected to bring, therefore no bring-keyboard to be enabled./n");		return;	}	write_log(preferences.debug_autoplayer(), "[BringKeyBoard] Connected to bring./n");	write_log(preferences.debug_autoplayer(), "[BringKeyBoard] Enabling bring-keyboard if necessary./n");	// Init locals	memset(&mii, 0, sizeof(MENUITEMINFO));	// Find position of "Keyboard" item on system menu	bringsysmenu = GetSystemMenu(p_autoconnector->attached_hwnd(), false);	mii.cbSize = sizeof(MENUITEMINFO);	mii.fMask = MIIM_STRING;	mii.fType = MFT_STRING;	mii.dwTypeData = temp;	keybd_item_pos = -1;	for (int i=GetMenuItemCount(bringsysmenu)-1; i>=0; i--) 	{		mii.cch = 256;			// Get the text of this menu item		GetMenuItemInfo(bringsysmenu, i, true, &mii);		c_text = temp;		// See if this is the "keyboard" menu item		if (c_text.MakeLower().Find("keyboard") != -1) 		{			keybd_item_pos = i;			continue;		}	}	// Get state of keyboard menu item	if (keybd_item_pos == k_undefined) 	{		return;	}	else 	{		mii.cbSize = sizeof(MENUITEMINFO);		mii.fMask = MIIM_STATE;		GetMenuItemInfo(bringsysmenu, keybd_item_pos, true, &mii);	}	if (!(mii.fState&MFS_CHECKED)) 	{		HWND			hwnd_focus;		POINT			cur_pos = {0};		input_count = 0;		// Alt key down		ZeroMemory(&input[input_count],sizeof(INPUT));		input[input_count].type = INPUT_KEYBOARD;		input[input_count].ki.wVk = VK_MENU;		input_count++;		// Space bar down		ZeroMemory(&input[input_count],sizeof(INPUT));		input[input_count].type = INPUT_KEYBOARD;		input[input_count].ki.wVk = VK_SPACE;		input_count++;		// Space bar up		ZeroMemory(&input[input_count],sizeof(INPUT));		input[input_count].type = INPUT_KEYBOARD;		input[input_count].ki.wVk = VK_SPACE;		input[input_count].ki.dwFlags = KEYEVENTF_KEYUP;		input_count++;		// Alt key up		ZeroMemory(&input[input_count],sizeof(INPUT));		input[input_count].type = INPUT_KEYBOARD;		input[input_count].ki.wVk = VK_MENU;		input[input_count].ki.dwFlags = KEYEVENTF_KEYUP;		input_count++;		CMyMutex mutex;		if (!mutex.IsLocked())			return;		hwnd_focus = GetFocus();		GetCursorPos(&cur_pos);		SetFocus(p_autoconnector->attached_hwnd());//.........这里部分代码省略.........
开发者ID:ohzooboy,项目名称:oh,代码行数:101,


示例21: my_kbd_handler

void my_kbd_handler (int keyboard, int scancode, int newstate){	int code = 0;	int scancode_new;	static int swapperdrive = 0;	if (scancode == specialkeycode ())		return;#ifdef WIN32        if (scancode == DIK_F11 && currprefs.win32_ctrl_F11_is_quit && ctrlpressed ())                code = AKS_QUIT;#endif	scancode_new = scancode;        if (!specialpressed () && inputdevice_iskeymapped (keyboard, scancode))                scancode = 0;#ifdef WIN32        // GUI must be always available        if (scancode_new == DIK_F12 && currprefs.win32_guikey < 0)                scancode = scancode_new;        if (scancode_new == currprefs.win32_guikey && scancode_new != DIK_F12)                scancode = scancode_new;#endif	write_log ("kbd= %d, sc_new= %d, scancode= %d (0x%02x), state= %d/n", keyboard, scancode_new, scancode, scancode, newstate);	if (newstate == 0 && code == 0) {		switch (scancode)		{                        case DIK_SYSRQ:                        screenshot (specialpressed () ? 1 : 0, 1);                        break;		}	}        if (newstate && code == 0) {                if (scancode == DIK_F12 /*|| scancode == currprefs.win32_guikey*/) {                        if (ctrlpressed ()) {                                code = AKS_TOGGLEDEFAULTSCREEN;                        } else if (shiftpressed () || specialpressed ()) {                                if (isfullscreen() <= 0) {                                        //disablecapture ();                                        code = AKS_ENTERDEBUGGER;                                }                        } else {                                code = AKS_ENTERGUI;                        }                }                switch (scancode)                {                case DIK_F1:                case DIK_F2:                case DIK_F3:                case DIK_F4:                        if (specialpressed ()) {                                if (ctrlpressed ()) {                                } else {                                        if (shiftpressed ())                                                code = AKS_EFLOPPY0 + (scancode - DIK_F1);                                        else                                                code = AKS_FLOPPY0 + (scancode - DIK_F1);                                }                        }                        break;                case DIK_F5:                        if (specialpressed ()) {                                if (shiftpressed ())                                        code = AKS_STATESAVEDIALOG;                                else                                        code = AKS_STATERESTOREDIALOG;                        }                        break;                case DIK_1:                case DIK_2:                case DIK_3:                case DIK_4:                case DIK_5:                case DIK_6:                case DIK_7:                case DIK_8:                case DIK_9:                case DIK_0:                        if (specialpressed ()) {                                int num = scancode - DIK_1;                                if (shiftpressed ())                                        num += 10;                                if (ctrlpressed ()) {                                       swapperdrive = num;                                        if (swapperdrive > 3)                                                swapperdrive = 0;                                } else {                                        int i;                                        for (i = 0; i < 4; i++) {                                                if (!_tcscmp (currprefs.floppyslots[i].df, currprefs.dfxlist[num]))                                                        changed_prefs.floppyslots[i].df[0] = 0;                                        }                                        _tcscpy (changed_prefs.floppyslots[swapperdrive].df, currprefs.dfxlist[num]);//.........这里部分代码省略.........
开发者ID:ezgranny420,项目名称:PUAE,代码行数:101,


示例22: add_seglist

static void add_seglist(const char *name, uae_u32 seglist_addr){    if(seglist_addr == 0) {        return;    }    /* first count the number of segments */    int num_segs = 0;    uae_u32 ptr = seglist_addr;    while(ptr != 0) {        ptr = get_long(ptr) << 2;        num_segs ++;    }    /* alloc seglist */    seglist *sl = xmalloc(seglist, 1);    if(sl == NULL) {        write_log("segtracker: NO seglist MEMORY!/n");        return;    }    segment *segs = xmalloc(segment, num_segs + 1); // add an empty segment    if(segs == NULL) {        write_log("segtracker: NO segments MEMORY!/n");        return;    }    /* fill seglist */    sl->name = my_strdup(name);    sl->addr = seglist_addr;    sl->num_segments = num_segs;    sl->segments = segs;    sl->next = NULL;    sl->prev = NULL;    sl->debug = NULL;    /* fill segments */    ptr = seglist_addr;    segment *s = segs;    while(ptr != 0) {        s->size = get_long(ptr - 4); // size of BPTR + segment        s->size -= 8; // correct size        s->addr = ptr + 4;        s->debug = NULL;        ptr = get_long(ptr) << 2; // BPTR to next segment        s++;    }    /* last segment is zero */    s->size = 0;    s->addr = 0;    /* link seglist */    if(segtracker_pool.first == NULL) {        segtracker_pool.first = sl;        segtracker_pool.last = sl;    } else {        sl->prev = segtracker_pool.last;        segtracker_pool.last->next = sl;        segtracker_pool.last = sl;    }    segtracker_pool.num_seglists ++;}
开发者ID:alpine9000,项目名称:fs-uae,代码行数:61,


示例23: amiga_clipboard_die

void amiga_clipboard_die (void){	signaling = 0;	write_log ("clipboard not initialized/n");}
开发者ID:ezgranny420,项目名称:PUAE,代码行数:5,


示例24: dump

//Function:     dump//Description:  dumps the key_count and property_count of respective file,//              dumps the inventory table data from main to secondary memory//Input param:  NULL//Return Type:  integer//              Success status on successful operation//              otherwise respective error status codeint dump(){    // Local variables    int spec_index;    int key_index;    // File pointer    FILE *fp;    FILE *tfp;    // Open the file in write mode and dump the latest key count    fp = fopen("key_count.txt","w+");    if(fp == NULL) {        write_log("dump", "FILE_OPEN_ERROR", "Unable to open the key_count file");        tfp = fopen("tempfile.txt", "a+");        fprintf(tfp, "%s","/nFollowing contents to be added in said file");        fprintf(tfp, "%s", "key_count.txt/n");        fprintf(tfp,"%d", key_count);        fclose(tfp);        return FAILURE;    }    fprintf(fp,"%d", key_count);    write_log("dump", "SUCCESS", "Key count dumped successfully");    fclose(fp);    // Open the file in write mode and dump the latest properties count    fp = fopen("property_count.txt","w+");    if(fp == NULL) {        write_log("dump", "FILE_OPEN_ERROR", "Unable to open the property_count file");        tfp = fopen("tempfile.txt", "a+");        fprintf(tfp, "%s","/nFollowing contents to be added in said file");        fprintf(tfp, "%s", "property_count.txt/n");        fprintf(tfp,"%d", property_count);        fclose(tfp);        return FAILURE;    }    fprintf(fp,"%d", property_count);    write_log("dump", "SUCCESS", "Property count dumped successfully");    fclose(fp);    // Open the inventory file and update the values from the main memory    // Into the secondary storage    fp = fopen("inventory_file.txt", "w+");    if (fp == NULL) {        write_log("dump", "FILE_OPEN_ERROR", "Unable to open the inventory_file");        tfp = fopen("tempfile.txt", "a+");        fprintf(tfp, "%s","/nFollowing contents to be added in said file");        fprintf(tfp, "%s", "inventory_file.txt/n");        for (spec_index = 0; spec_index <= property_count; spec_index++) {            for (key_index = 0; key_index <= key_count; key_index++) {                fprintf(tfp, "%s ", inventory[spec_index][key_index]);            }            fprintf(tfp, "%s", "/n");        }        fclose(tfp);        return FAILURE;    }    for (spec_index = 0; spec_index <= property_count; spec_index++) {        for (key_index = 0; key_index <= key_count; key_index++) {            fprintf(fp, "%s ", inventory[spec_index][key_index]);        }        fprintf(fp, "%s", "/n");    }    fclose(fp);    // Free the memory for inventory    inventory_memory_deallocation();    write_log("dump", "SUCCESS", "Inventory table dumped successfully");    // Close the log file    close_log();    return SUCCESS;}
开发者ID:prakashbh,项目名称:inventory-data-structure,代码行数:82,


示例25: amiga_clipboard_init

void amiga_clipboard_init (void){	signaling = 0;	write_log ("clipboard initialized/n");	initialized = 1;}
开发者ID:ezgranny420,项目名称:PUAE,代码行数:6,


示例26: SQL_getSolutionSource

int SQL_getSolutionSource(JUDGE_SUBMISSION_ST *pstJudgeSubmission){	if (NULL == pstJudgeSubmission)	{		write_log(JUDGE_ERROR,"SQL_getSolutionSourceEx, Input param is null...");		return OS_ERR;	}	SQL_SemP();	sprintf(query,"select source from solution_source where solution_id=%d",			pstJudgeSubmission->stSolution.solutionId);	int ret=mysql_real_query(mysql,query,(unsigned int)strlen(query));	if(ret)	{		write_log(JUDGE_ERROR,mysql_error(mysql));		SQL_SemV();		return OS_ERR;	}	MYSQL_RES *recordSet = mysql_store_result(mysql);	if (recordSet==NULL)	{		write_log(JUDGE_ERROR,"SQL_getSolutionSource");		SQL_SemV();		return OS_ERR;	}	FILE *fp_source = fopen(pstJudgeSubmission->sourcePath, "w");	char code[MAX_CODE]={0};	MYSQL_ROW row;	if(row = mysql_fetch_row(recordSet))	{		sprintf(code, "%s", row[0]);	}	else	{		write_log(JUDGE_ERROR,"SQL_getSolutionSource Error");	}	if(pstJudgeSubmission->isTranscoding == 1)	{		int ii=0;		/* 解决VS下字符问题 */		while (code[ii]!='/0')		{			if (code[ii]=='/r')			{				code[ii] = '/n';			}			ii++;		}	}	fprintf(fp_source, "%s", code);	/* add for vjudge*/	strcpy(pstJudgeSubmission->szSource, code);	mysql_free_result(recordSet);	fclose(fp_source);	SQL_SemV();	return OS_OK;}
开发者ID:TomasCheng,项目名称:judge,代码行数:69,


示例27: amiga_clipboard_task_start

void amiga_clipboard_task_start (uaecptr data){	clipboard_data = data;	signaling = 1;	write_log ("clipboard task init: %08x/n", clipboard_data);}
开发者ID:ezgranny420,项目名称:PUAE,代码行数:6,


示例28: write_logautoplay

void write_logautoplay(const char * action) {    char		nowtime[26];    CString		pcards, comcards, temp, rank, pokerhand, bestaction, fcra_seen;    char		*card;    CardMask	Cards;    int			nCards;    CString		fcra_formula_status;	int			sym_userchair = (int) p_symbol_engine_userchair->userchair();	int			betround = (int) p_betround_calculator->betround();	if (!prefs.trace_enabled())		return;	if (log_fp != NULL) 	{		CSLock lock(log_critsec);		// log$ writing		if (prefs.log_symbol_enabled())		{			int max_log = p_symbols->logsymbols_collection()->GetCount();			if (max_log > 0)			{				if (max_log > prefs.log_symbol_max_log())				{					max_log = prefs.log_symbol_max_log();				}				write_log(k_always_log_basic_information, "*** log$ (Total: %d | Showing: %d)/n", p_symbols->logsymbols_collection()->GetCount(), max_log);				for (int i=0; i<max_log; i++)				{					write_log(k_always_log_basic_information, "***     %s/n", p_symbols->logsymbols_collection()->GetAt(i));				}			}		}				CardMask_RESET(Cards);		nCards=0;		// player cards		if (p_symbol_engine_userchair->userchair_confirmed()) 		{			for (int i=0; i<=1; i++) 			{				card = StdDeck_cardString(p_scraper->card_player(sym_userchair, i));				temp.Format("%s", card);				pcards.Append(temp);				CardMask_SET(Cards, p_scraper->card_player(sym_userchair, i));				nCards++;			}		}		else 		{			pcards = "....";		}		// common cards		comcards = "";		if (betround >= k_betround_flop) 		{			for (int i=0; i<=2; i++) 			{				if (p_scraper->card_common(i) != CARD_BACK && 					p_scraper->card_common(i) != CARD_NOCARD) 				{					card = StdDeck_cardString(p_scraper->card_common(i));					temp.Format("%s", card);					comcards.Append(temp);					CardMask_SET(Cards, p_scraper->card_common(i));					nCards++;				}			}		}		if (betround >= k_betround_turn) 		{			card = StdDeck_cardString(p_scraper->card_common(3));			temp.Format("%s", card);			comcards.Append(temp);			CardMask_SET(Cards, p_scraper->card_common(3));			nCards++;		}		if (betround >= k_betround_river) 		{			card = StdDeck_cardString(p_scraper->card_common(4));			temp.Format("%s", card);			comcards.Append(temp);			CardMask_SET(Cards, p_scraper->card_common(4));			nCards++;		}        comcards.Append("..........");        comcards = comcards.Left(10);//.........这里部分代码省略.........
开发者ID:buranela,项目名称:OpenHoldemV12,代码行数:101,


示例29: expamem_lget

static uae_u32 REGPARAM2 expamem_lget (uaecptr addr){    write_log ("warning: READ.L from address $%lx PC=%x/n", addr, M68K_GETPC);    return (expamem_wget (addr) << 16) | expamem_wget (addr + 2);}
开发者ID:voorhees1979,项目名称:PUAE,代码行数:5,



注:本文中的write_log函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ write_loop函数代码示例
C++ write_lock_irqsave函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。