Пример #1
0
/// Configuration  : TESTING
/// Function name  : checkCommandTranslation
// Description     : Check whether the translation of a command matches a specified string
// 
// CONST LIST*   pCommandList   : [in] List of translated COMMAND objects found in a ScriptFile
// CONST UINT    iIndex         : [in] Index of the COMMAND to verify
// CONST TCHAR*  szTranslation  : [in] String to verify the COMMAND translation against
// 
// Return Value   : TRUE if successfully verified, FALSE otherwise
// 
BOOL  checkCommandTranslation(CONST LIST* pCommandList, CONST UINT  iIndex, CONST TCHAR*  szTranslation)
{
   LIST_ITEM*  pListItem;  // ListItem wrapper
   COMMAND*    pCommand;   // Translated COMMAND to check
   BOOL        bResult;    // Verification result

   // Prepare
   bResult = FALSE;

   /// Lookup COMMAND
   if (findListItemByIndex(pCommandList, iIndex, pListItem))
   {
      // Extract COMMAND
      pCommand = (COMMAND*)pListItem->oData;

      /// Check translation
      bResult = (StrCmpI(szTranslation, pCommand->szBuffer) == 0);

      // [FAILED] Print out desired and actual translation
      if (!bResult)
         CONSOLE("ERROR: Command '%s' incorrectly translated as '%s'", szTranslation, pCommand->szBuffer);
   }
   // [ERROR] Command not translated
   else
      CONSOLE("ERROR: Command '%s' (index %u) was not present", szTranslation, iIndex);
   
   /// Return result
   return bResult;
}
Пример #2
0
	//-----------------------------------------------------------------------
	int Console( lua_State *L )
	{
		const char *typeName = lua_typename( L, lua_type(L, 1) );
		if( lua_isnumber( L, 1 ) )
		{
			float arg1 = (float)lua_tonumber( L, 1 );
//	#ifdef WIN32
//			_NSLog( "%f", arg1 );
//	#else
			CONSOLE( "Console:%f", arg1 );
//	#endif
		} else
		if( lua_isstring( L, 1 ) )
		{
			const char *arg1 = (const char *)lua_tostring( L, 1 );
			
			CONSOLE( "Console:%s", Convert_char_To_TCHAR( arg1 ) );
		} else
		if( lua_isuserdata( L, 1 ) )
		{
			void *p = lua_touserdata( L, 1 );
			CONSOLE( "Console:0x%08x", (unsigned long)p );
			int a = 0; a = 1;
		} else
		if( lua_isnil( L, 1 ) )
		{
			CONSOLE("Console: nil");
		} else
		{
			void *p = lua_touserdata( L, 1 );
			CONSOLE("Console: unkwoun type");
		}
		return 1;
	}
Пример #3
0
int dx_v4l2_init_mmap(int fd, uint8_t** buffer) {
    struct v4l2_requestbuffers req = {0};
    req.count = 1;
    req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    req.memory = V4L2_MEMORY_MMAP;

    if (-1 == xioctl(fd, VIDIOC_REQBUFS, &req)) {
        ERROR("Requesting Buffer");
        return 1;
    }

    struct v4l2_buffer buf = {0};
    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    buf.memory = V4L2_MEMORY_MMAP;
    buf.index = 0;
    if(-1 == xioctl(fd, VIDIOC_QUERYBUF, &buf)) {
        ERROR("Querying Buffer");
        return 1;
    }

    *buffer = mmap (NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset);
    CONSOLE("Length: %d\nAddress: %p\n", buf.length, buffer);
    CONSOLE("Image Length: %d\n", buf.bytesused);

    return 0;
}
Пример #4
0
static void ICACHE_FLASH_ATTR syslog_dns_callback(const char * hostname, ip_addr_t * addr, void * arg)
{
	sint8 rc;

	/**
	 * Store the target IP address.
	 */
	if (addr != NULL)
	{
	    // // CONSOLE("syslog: Hostname: %s, IP address: " IPSTR, hostname, IP2STR(addr));
        os_memcpy(syslog_conn->proto.udp->remote_ip, addr, 4);
	    // // CONSOLE("syslog: Hostname: %s, IP address: " IPSTR, hostname, IP2STR(addr));
	    CONSOLE("syslog: local IP address:port = " IPSTR ":%d", IP2STR(syslog_conn->proto.udp->local_ip), syslog_conn->proto.udp->local_port);
	    CONSOLE("syslog: remote IP address:port = " IPSTR ":%d", IP2STR(syslog_conn->proto.udp->remote_ip), syslog_conn->proto.udp->remote_port);
        syslog_inactive = FALSE;
        rc = espconn_create(syslog_conn);
        if (rc == 0)
        {
      	    rc = espconn_regist_sentcb(syslog_conn, syslog_sendto_callback);
        }
        if (rc != 0)
        {
        	// CONSOLE("syslog: create UDP connection failed: %d", (int)rc);
        }
        syslog_sendto();
	}
	else
	{
		// CONSOLE("syslog: gethostbyname() for '%s' failed!", hostname);
	}
}
/// Function name  : onDependenciesPage_ContextMenu
// Description     : Display the ScriptDependencies or VariableDependencies Popup Menu
// 
// SCRIPT_DOCUMENT*  pDocument : [in] Script document data
// HWND              hCtrl     : [in] Window handle of the control sending the message
// CONST UINT        iCursorX  : [in] Screen co-ordinate cursor X position
// CONST UINT        iCursorY  : [in] Screen co-ordinate cursor Y position
// 
// Return Value   : TRUE
// 
BOOL  onDependenciesPage_ContextMenu(SCRIPT_DOCUMENT*  pDocument, HWND  hCtrl, CONST UINT  iCursorX, CONST UINT  iCursorY)
{
   CUSTOM_MENU*  pCustomMenu;    // Custom Popup menu
   UINT          iSubMenuID;     // Popup submenu ID

   // [TRACK]
   CONSOLE_ACTION();

   // Determine submenu
   switch (GetWindowID(hCtrl))
   {
   /// [LISTVIEW] Display the appropriate popup menu
   case IDC_DEPENDENCIES_LIST:   iSubMenuID = IDM_DEPENDENCIES_POPUP;  CONSOLE("Displaying dependencies menu");  break;
   case IDC_VARIABLES_LIST:      iSubMenuID = IDM_VARIABLES_POPUP;     CONSOLE("Displaying variables menu");     break;
   case IDC_STRINGS_LIST:        iSubMenuID = IDM_STRINGS_POPUP;       CONSOLE("Displaying strings menu");       break;
   default:                      return FALSE;
   }

   // Create Dependencies Custom Popup menu
   pCustomMenu = createCustomMenu(TEXT("SCRIPT_MENU"), TRUE, iSubMenuID);

   /// [DEPENDENCIES] Disable 'Load script' if no item is selected
   if (GetWindowID(hCtrl) == IDC_DEPENDENCIES_LIST)
      EnableMenuItem(pCustomMenu->hPopup, IDM_DEPENDENCIES_LOAD, (ListView_GetSelectedCount(hCtrl) > 0 ? MF_ENABLED : MF_DISABLED));

   /// Display context menu
   TrackPopupMenu(pCustomMenu->hPopup, TPM_TOPALIGN WITH TPM_LEFTALIGN, iCursorX, iCursorY, NULL, GetParent(hCtrl), NULL);

   // Cleanup and return TRUE
   deleteCustomMenu(pCustomMenu);
   return TRUE;
}
void
debug_memdump()
{
    struct mhdr *h;

    CONSOLE("[M] %s: @@@ memory dump starts\n", timestamp());
    for (h = mem; h; h = h->next) {
#ifdef CCNL_ARDUINO
        sprintf_P(logstr, PSTR("addr %p %5d Bytes, "),
                  (int)((unsigned char *)h + sizeof(struct mhdr)),
                  h->size);
        Serial.print(logstr);
        // remove the "src/../" prefix:
        strcpy_P(logstr, h->fname);
        Serial.print(getBaseName(logstr));
        CONSOLE(":%d @%d.%03d\n", h->lineno,
                int(h->tstamp), int(1000*(h->tstamp - int(h->tstamp))));
#else
        CONSOLE("addr %p %5d Bytes, %s:%d @%s\n",
                (unsigned char *)h + sizeof(struct mhdr),
                h->size, getBaseName(h->fname), h->lineno, h->tstamp);
#endif
    }
    CONSOLE("[M] %s: @@@ memory dump ends\n", timestamp());
}
Пример #7
0
/* target-specific putchar():
 * When buffer has space available, load the incoming character
 * into the UART.
 */
int
target_putchar(char c)
{
	/* Wait for transmit ready bit */
	while(!(*(vushort *)CONSOLE(LSR) & THRE));

	*(vushort *)CONSOLE(THR) = (ushort)c;

	return((int)c);
}
Пример #8
0
/**
 @brief 
*/
void XEWinConnectionInServer::ProcessHeartBeat()
{
// 	XLOCK_OBJ;
	//////////////////////////////////////////////////////////////////////////
	if( m_modeHeartBeat == xHB_READY ) {
		if( m_timerHeartBeat.IsOff() )
			m_timerHeartBeat.Set( 10.f );
		// x초 기다리고 요청패킷을 보내본다.
		if( m_timerHeartBeat.IsOver() ) {
			// 확인패킷 보내고 10초짜리 타이머 돌린다. 10초안에 응답이 안오면 이 커넥트는 끊는다.
			// 아이폰에서 테스트할때 와이파이에서 3G로 바꿔서 연결끊어졌는데 소켓으로 데이타는 계속 날아가는
			// 현상 있었음. 클라가보내는 응답도 받아야 할듯?
			XPacket ar((ID)XE::xXEPK_REQUEST_HB);
			Send( ar );		
			if( IsDisconnected() == FALSE ) {
				m_modeHeartBeat = xHB_REQUEST;
				float secNotResponse = 40.f;	// 디폴트
				if( XEOption::sGet() ) {
					auto sec = XEOption::sGet()->GetParam().GetFloat( "sec_not_response" );
					if( sec > 0 ) {
						secNotResponse = sec;
					} else {
						CONSOLE( "경고: ini에 sec_not_response값이 정해지지 않았음. 디폴트 40초로 합니다." );
					}
				}
				m_timerHeartBeat.Set( secNotResponse );
			}
		}
	} else
	//////////////////////////////////////////////////////////////////////////
	if( m_modeHeartBeat == xHB_REQUEST ) {
		// 기다리는중. 
		if( m_timerHeartBeat.IsOver() ) {
#if defined(_DEBUG) && !defined(_XNOT_BREAK)
			m_modeHeartBeat = xHB_READY;
			m_timerHeartBeat.Off();
//			DoDisconnect();		// 디버그 모드에서 끊김 테스트를 위해..
#else
			// 응답이 없으므로 이 커넥션은 끊는다.
#if _DEV_LEVEL <= DLV_DEV_EXTERNAL
			auto spUser = GetspUser();
			if( spUser ) {
				CONSOLE("응답이 없는 소켓이 발견되어 연결을 끊습니다: ip=%s, idAcc=%d", m_szIP, spUser->GetidUser() );
			} else {
				CONSOLE("응답이 없는 소켓이 발견되어 연결을 끊습니다: %s", m_szIP );
			}
#endif
      OnFireConnectBefore();    // 서버에서 자르기 전에 이벤트 핸들러.
			DoDisconnect();
			m_timerHeartBeat.Off();
#endif // not debug
		} 
	}// else
}
Пример #9
0
void XClientConnection::OnError( xtError error, DWORD param1, DWORD param2 )
{
#pragma message("여기서 에러를 바로 처리하지말고 에러메시지만 쌓아놨다가 메인스레드에서 일괄 처리하자.")
	if( GetspUser() ) {
		auto pUser = SafeCast<XGameUser*>( GetspUser().get() );
		if( error == XENetworkConnection::xERR_PACKET_SIZE_TO_LARGE ) {
			CONSOLE( "IP address=%s: 너무 큰 패킷(%d byte)이 날아와 접속을 끊었습니다.",  GetszIP(), param1 );
		}
	} else {
		CONSOLE( "IP address=%s: 너무 큰 패킷(%d byte)이 날아와 접속을 끊었습니다.", GetszIP(), param1 );
	}
}
Пример #10
0
/// Configuration  : TESTING
/// Function name  : onTestCaseComplete
// Description     : Verify the results of a TestCase
// 
// MAIN_WINDOW_DATA*    pMainWindowData  : [in] Main window data
// CONST OPERATION_DATA*  pOperationData   : [in] OperationData of the thread loading the GameData
// 
// Return Value   : TRUE if validation was succesful, FALSE otherwise
// 
BOOL  onTestCaseComplete(MAIN_WINDOW_DATA*  pMainWindowData, CONST OPERATION_DATA*  pOperationData)
{
   BOOL   bResult;            // Verification result
   UINT   iNextTestCaseID;    // ID of the TestCase following the input TestCase

   // [CHECK] OperationData is a TestCase
   if (pOperationData->iTestCaseID == NULL)
      return FALSE;

   /// Verify result according to type
   switch (identifyTestCaseType(pOperationData->iTestCaseID))
   {
   // [GAME DATA]
   case TCT_GAME_DATA:  
      bResult = verifyGameDataTestCase(pOperationData->iTestCaseID, pOperationData);
      break;

   // [SCRIPT TRANSLATION]
   case TCT_SCRIPT_TRANSLATION:
      bResult = verifyScriptTranslationTestCase(pOperationData->iTestCaseID, pOperationData);
      
      // Close open document
      if (bResult)
         onMainWindowFileClose(pMainWindowData);
      break;
   }

   /// Print result and (possibly) launch next test case
   switch (bResult)
   {
   // [SUCCESS] Run next test case. (give the progress dialog time to destroy itself)
   case TRUE:
      CONSOLE("TestCase %03u: SUCCESSFUL", pOperationData->iTestCaseID);

      // Check whether there are any more test cases
      if (findNextTestCaseID(pOperationData->iTestCaseID, iNextTestCaseID))
         // Launch next test case
         PostMessage(pMainWindowData->hMainWnd, UM_TESTCASE_BEGIN, identifyTestCaseType(iNextTestCaseID), iNextTestCaseID);
      break;

   // [FAILURE] Abort processing
   case FALSE:
      CONSOLE("TestCase %03u: FAILED! Aborting TestCases....", pOperationData->iTestCaseID);
      break;
   }

   // DEBUGGING
   CONSOLE("---------------------------");
   // Return result
   return bResult;
}
Пример #11
0
void
debug_free(void *p, const char *fn, int lno)
{
    struct mhdr *h = (struct mhdr *) (((unsigned char *)p) - sizeof(struct mhdr));

    if (!p) {
//      CONSOLE("%s: @@@ memerror - free() of NULL ptr at %s:%d\n",
//         timestamp(), fn, lno);
        return;
    }
    if (debug_unlink(h)) {
        CONSOLE(
           "%s @@@ memerror - free() at %s:%d does not find memory block %p\n",
                timestamp(), fn, lno, p);
        return;
    }
#ifndef CCNL_ARDUINO
    if (h->tstamp && *h->tstamp)
        free(h->tstamp);
#endif
    //free(h);
    // instead of free: do a
       memset(h+1, 0x8f, h->size);
    // to discover continued use of a freed memory zone
}
Пример #12
0
void XSessionWinsock::RecvThread( void ) 
{
//	int sizePacket = 0;
//	int totalRead = 0;
	while(1)
	{
		// 큐에 받을 버퍼가 더이상 없으면 걍 리턴
		if( m_qBuffer.IsFull() )		
			continue;
		// 소켓에서 패킷을 읽어 버퍼에 저장
		int readbytes; 
		if( m_Mode == xCLIENT )
			readbytes = recv( m_Socket, (char *)m_Buffer, sizeof(m_Buffer), 0 );		// 버퍼크기만큼 패킷을 읽어온다
		else
			readbytes = recv( m_Client, (char *)m_Buffer, sizeof(m_Buffer), 0 );		// 버퍼크기만큼 패킷을 읽어온다
		XBREAK( readbytes > (int)sizeof(m_Buffer) );
		if( readbytes <= 0 )
		{
			CONSOLE( "network error(%d)", WSAGetLastError() );
			m_bDisconnect = TRUE;
			return;
		}
		// 버퍼의 내용을 큐로 보냄
		EnterCriticalSection( &m_cs );
		m_qBuffer.PushBlock( m_Buffer, readbytes );	// 최적화를 위해 만듬. 큐에 하나씩 보내지않고 뭉탱이로 보냄
		g_sizeQBuffer = m_qBuffer.Size();
		LeaveCriticalSection( &m_cs );
	}
}
Пример #13
0
/* target-specific gotachar():
 * Return 0 if no char is avaialable at UART rcv fifo; else 1.
 * Do NOT pull character out of fifo, just return status. 
 */
int
gotachar(void)
{
    if (*(vushort *)CONSOLE(LSR) & DR)
        return(1);
    return(0);	
}
Пример #14
0
void XOrderIndicate::Process( float dt )
{
	if( m_timerSec.IsOver() ) {
		if( CreateIndicator() == false ) {
			if( ++m_numFailed >= 3 )
				SetbEnd( true );	// 타겟을 3초간 못찾으면 그냥 끝냄.
		}
		m_timerSec.Reset();
	}
	// 시간되면 자동 종료
	if( m_timerFinish.IsOver() ) {
		// 이 인디케이터가 다른 order의 end가 종료시점일때
		if( GetspProp()->m_typeEnd == xFIN_END_ORDER ) {
			auto spOrderProp = m_spPropSeq->GetspOrderProp( GetspProp()->m_idsEnd );
			if( XASSERT(spOrderProp) ) {
				// 그 다른 order가 touch방식이 아닐때만 자동 사라짐.
				if( spOrderProp->m_typeEnd != xFIN_TOUCH ) {
					CONSOLE("XOrderIndicate::Process:시간초과로 자동 종료됨.");
					SetbEnd( true );
					m_timerFinish.Off();
				} else {
					m_timerFinish.Off();		// 더이상 검사하지 않도록.
				}
			}
		} else
		if( GetspProp()->m_typeEnd == xFIN_DELAY ) {
			m_timerFinish.Off();
			SetbEnd( true );
		}
	}
}
Пример #15
0
XAccount::XAccount() 
{ 
	Init(); 
#ifdef _CLIENT
	CONSOLE( "create account: %s", XE::GetTimeString() );
#endif
}
Пример #16
0
int syslog_write_index()
{
	int write_index = syslog_stack_tail;

	/**
	 * If the stack is full, we continue overwriting the last entry so that
	 * the first (depth-1) entries reflect what went wrong when the stack
	 * blocked.
	 */
	if (syslog_stack_depth < SYSLOG_STACK_DEPTH)
	{
		syslog_stack_depth++;
		if (syslog_stack_depth < SYSLOG_STACK_DEPTH)
		{
			syslog_stack_tail++;
			if (syslog_stack_tail >= SYSLOG_STACK_DEPTH)
			{
				/**
				 * Writing is wrapping to the start of the array.
				 */
				syslog_stack_tail = 0;
			}
		}
	}

	CONSOLE("wi: %d, %d, %d, %d", write_index, syslog_stack_depth, syslog_stack_tail, SYSLOG_STACK_DEPTH);
	return(write_index);
}
Пример #17
0
/// Function name  : setActiveDocument
// Description     : Updates the 'ActiveDocument' and displays the specified document
// 
// DOCUMENTS_DATA*  pWindowData : [in] Window data
// DOCUMENT*        pDocument   : [in] Target document
// 
VOID  setActiveDocument(DOCUMENTS_DATA*  pWindowData, DOCUMENT*  pDocument)
{
   // [TRACK]
   CONSOLE_COMMAND_BOLD1(getDocumentFileName(pDocument));
   CONSOLE("Activating document '%s'", pDocument ? pDocument->szFullPath : NULL);

   // Replace ActiveDocument
   pWindowData->pActiveDocument = pDocument;

   // [CHECK] Are we switching to a Document or NULL?
   if (pDocument)
   {
      /// [DOCUMENT] Resize document appropriately
      updateDocumentSize(pWindowData, pDocument);

      /// Display new document and set focus
      ShowWindow(pDocument->hWnd, SW_SHOWNORMAL);
      UpdateWindow(pDocument->hWnd);
      SetFocus(pDocument->hWnd);

      // [DEBUG]
      //DEBUG_WINDOW("ActiveDocument", pDocument->hWnd);
   }

   /// [EVENT] Document switched
   sendDocumentSwitched(AW_DOCUMENTS_CTRL, pDocument);
}
Пример #18
0
/**
 비동기로 recv를 시킴
 다수의 워커스레드로부터 호출됨.
*/
void XEWinConnectionInServer::tWSARecv( void )
{
	//
	do 	{
		unsigned long readbytes; 
		// 비동기로 전송처리, 큐에 올라감. 이걸해야 스레드에서 데이타가 받아짐.
	#ifdef _USING_WSA 
		WSABUF b[1]; 
		unsigned long flags = 0; 
 		memset( &m_opRecv, 0, sizeof(m_opRecv) );
		m_opRecv.typeEvent = 2;
		b[0].buf = (CHAR *)m_Buffer; 
		b[0].len = sizeof(m_Buffer); 
		if( WSARecv( m_Socket, b, 1, &readbytes, &flags, &m_opRecv, NULL ) == SOCKET_ERROR )
	#else
		// 최초 accept시에는 아래처림 == FALSE로 검사하면 안됨. 원래 0나옴
		if( ReadFile( (HANDLE)m_Socket, m_Buffer, sizeof(m_Buffer), &readbytes, &m_op ) == FALSE )
	#endif
		{
			const auto lastErr = GetLastError();
			XBREAKF( lastErr != WSAECONNRESET	&& lastErr != ERROR_IO_PENDING
						, "WSARecv error:err=%d", lastErr );
			if( lastErr != WSAECONNRESET		// 접속끊김
				&& lastErr != ERROR_IO_PENDING ) {	// IO처리중
				CONSOLE( "WSARecv error: socket=%x, error=%d", m_Socket, lastErr );
				ClearConnection();
			}
		}
	} while(0);
	//
	return;
}
Пример #19
0
void OnPurchaseError( const char *cErr )
{
	if( cErr )
		CONSOLE("XE::OnPurchaseError:%s", C2SZ(cErr) );
	if( GetMain()->GetpGame() )
		GetMain()->GetpGame()->OnPurchaseError( cErr );
}
Пример #20
0
/// Configuration  : TESTING
/// Function name  : checkErrorQueueMessages
// Description     : Checks an ErrorQueue for the specified Message IDs and prints which errors are missing (if any)
//                      to the debugging console
// 
// CONST ERROR_QUEUE*  pErrorQueue   : [in] ErrorQueue to search
// CONST UINT          iTestCaseID   : [in] TestCase number
// CONST UINT          iMessageCount : [in] Number of message IDs to search for
//     ...             ...           : [in] Message IDs to search for
// 
// Return Value   : TRUE if all messages were found, FALSE otherwise
// 
BOOL  checkErrorQueueMessages(CONST ERROR_QUEUE*  pErrorQueue, CONST UINT  iTestCaseID, CONST UINT  iMessageCount, ...)
{
   MESSAGE_SEARCH  oMessages[10];   // Message IDs to be searched for and their results
   va_list         pArgument;       // Variable argument iterator
   BOOL            bResult;         // Operation result

   // Prepare
   pArgument = utilGetFirstVariableArgument(&iMessageCount);
   utilZeroObjectArray(oMessages, MESSAGE_SEARCH, 10);
   bResult = TRUE;

   /// Search the ErrorQueue for each of the MessageIDs specified in the variable arguments
   for (UINT i = 0; i < iMessageCount; i++)
   {
      // Retrieve message ID
      oMessages[i].iMessage = utilGetCurrentVariableArgument(pArgument, UINT);
      pArgument = utilGetNextVariableArgument(pArgument, UINT);

      // Search error queue
      oMessages[i].bFound = hasErrorQueueMessage(pErrorQueue, oMessages[i].iMessage);
   }

   /// [CHECK] Were all messages found?
   for (UINT i = 0; i < iMessageCount; i++)
   {
      // [NOT FOUND] Print to console and change result to FALSE
      if (oMessages[i].bFound == FALSE)
      {
         CONSOLE("WARNING: TC.%03u : The specified ErrorQueue does not contain Message index #%u (ID:%03u)", iTestCaseID, i + 1, oMessages[i].iMessage);
         bResult = FALSE;
      }
   }

   // [CHECK] Where the correct number of messages present?
   if (iMessageCount != getErrorQueueCount(pErrorQueue))
   {
      CONSOLE("WARNING: TC.%03u : The ErrorQueue has %u messages when %u were expected", iTestCaseID, getErrorQueueCount(pErrorQueue), iMessageCount);
      bResult = FALSE;
   }

   // [FAILED] Display error message
   if (!bResult AND hasErrors(pErrorQueue))
      displayErrorQueueDialog(NULL, pErrorQueue, NULL);

   // Return result
   return bResult;
}
Пример #21
0
/**
 * Try to send the next buffered syslog entry.
 */
static void syslog_sendto()
{
	sint16 rc = 0;
	uint8 *buffer;
	uint16 length;

	if (syslog_sending || syslog_inactive)
	{
		/**
		 * Already sending or no IP so buffer this.
		 */
		CONSOLE("inactive %d, sending %d", syslog_sending, syslog_inactive);
	}
	else
	{
		CONSOLE("syslog: %d, %d, %d", rc, syslog_stack_head, syslog_stack_tail);
		while ((rc == 0) &&
		       (syslog_stack_head != syslog_stack_tail))
		{
			// Recursion!!
			buffer = syslog_stack[syslog_stack_head];
			length = syslog_length[syslog_stack_head];
			syslog_stack_head++;
			syslog_stack_depth--;
			if (syslog_stack_head >= SYSLOG_STACK_DEPTH)
			{
				syslog_stack_head = 0;
			}
			rc = espconn_sendto(
					syslog_conn, buffer, length);
			if (rc == ESPCONN_INPROGRESS)
			{
				/**
				 * Asynchronous send.
				 */
				syslog_sending = TRUE;
			}
			else if (rc != 0)
			{
				CONSOLE("Error: syslog, sendto failed: %d", rc);
			}
			CONSOLE("syslog2: %d, %d, %d", rc, syslog_stack_head, syslog_stack_tail);
		}
		CONSOLE("Done sending");
	}
}
Пример #22
0
static int serial_ready(ps_chardevice_t* device)
{
    uint32_t io_port = (uint32_t) device->vaddr;
    uint32_t res;
    int UNUSED error = ps_io_port_in(&device->ioops.io_port_ops, CONSOLE(io_port, LSR), 1, &res);
    assert(!error);
    return res & SERIAL_LSR_TRANSMITTER_EMPTY;
}
Пример #23
0
void show_error( const char *str )
{
#ifdef _XTOOL
	CONSOLE( "lua error: %s", Convert_char_To_TCHAR( str ) );
#else
	XBREAKF(1, "lua error: %s", Convert_char_To_TCHAR( str ) );
#endif
}
Пример #24
0
static void
blob(struct ccnl_buf_s *buf)
{
    unsigned char *cp = buf->data;
    unsigned int i;

    for (i = 0; i < buf->datalen; i++, cp++)
        CONSOLE("%02x", *cp);
}
Пример #25
0
static int serial_getchar(ps_chardevice_t *device)
{
    uint32_t res;
    uint32_t io_port = (uint32_t) device->vaddr;

    /* Check if character is available. */
    int error UNUSED = ps_io_port_in(&device->ioops.io_port_ops, CONSOLE(io_port, LSR), 1, &res);
    assert(!error);
    if (!(res & SERIAL_LSR_DATA_READY)) {
        return -1;
    }

    /* retrieve character */
    error = ps_io_port_in(&device->ioops.io_port_ops, CONSOLE(io_port, RBR), 1, &res);
    assert(!error);

    return (int) res;
}
Пример #26
0
static int serial_ready(ps_chardevice_t* device)
{
    uint32_t io_port = (uint32_t) (uintptr_t)device->vaddr;
    uint32_t res;
    int error = ps_io_port_in(&device->ioops.io_port_ops, CONSOLE(io_port, LSR), 1, &res);
    if (error != 0) {
        return 0;
    }
    return res & SERIAL_LSR_TRANSMITTER_EMPTY;
}
Пример #27
0
/// Configuration  : TESTING
/// Function name  : runGameDataTestCase
// Description     : Initiate a GameData TestCase. This will complete asynchronously
// 
// MAIN_WINDOW_DATA*  pMainWindowData : [in] Main window data
// CONST UINT        iTestCaseID     : [in] Number of the TestCase to run
// 
VOID  runGameDataTestCase(MAIN_WINDOW_DATA*  pMainWindowData, CONST UINT  iTestCaseID)
{
   TCHAR*  szFolderPath;

   // [CHECK] Ensure TestCase ID is valid
   ASSERT(identifyTestCaseType(iTestCaseID) == TCT_GAME_DATA);

   // Print title
   CONSOLE("Beginning Game Data Test Case %03u...", iTestCaseID);
   CONSOLE("-------------------------------------");

   // Change GameData folder to the TestCase data folder
   szFolderPath = generateTestCaseFolder(iTestCaseID);
   setAppPreferencesGameDataFolder(szFolderPath);

   // Unload existing data and attempt to load TestCase data
   performMainWindowReInitialisation(pMainWindowData, iTestCaseID);

   // Cleanup
   utilDeleteString(szFolderPath);
}
/// Function name  : onArgumentPage_EditArgument
// Description     : Create an appropriate control to edit the argument property specified by the 'ListView label
//                     editing data' within the specified document.
// 
// SCRIPT_DOCUMENT*  pDocument   : [in] The currently active document
// HWND              hListView   : [in] Window handle of the Arguments ListView
// 
VOID   onArgumentPage_EditArgument(SCRIPT_DOCUMENT*  pDocument, HWND  hListView)
{
   // [VERBOSE]
   CONSOLE_COMMAND();
   CONSOLE("Editing argument: iItem=%d  iSubItem=%d", pDocument->oItemClick.iItem, pDocument->oItemClick.iSubItem);

   /// Initiate label edit on correct item/subitem
   if (pDocument->oItemClick.iSubItem == ARGUMENT_COLUMN_TYPE)
      editCustomListViewItemEx(hListView, pDocument->oItemClick.iItem, pDocument->oItemClick.iSubItem, LVLT_COMBOBOX, CBS_OWNERDRAWFIXED, compareCustomComboBoxItems);
   else
      editCustomListViewItem(hListView, pDocument->oItemClick.iItem, pDocument->oItemClick.iSubItem, LVLT_EDIT);
}
Пример #29
0
bool XOrderTouchLock::DoControlWnd() 
{
	XBREAK( m_spProp->m_aryIdsTarget.size() == 0 );
	// 특정윈도우를 입력잠금하거나 푼다.
	int numFounds = 0;
	for( auto& idsTarget : m_spProp->m_aryIdsTarget ) {
		auto pWnd = GAME->Find( idsTarget );
		if( pWnd ) {
			pWnd->SetbActive( m_spProp->m_bFlag );
			++numFounds;
			if( m_spProp->m_bFlag == false )
				CONSOLE( "XOrderTouch::locked=%s", C2SZ(idsTarget) );
			else
				CONSOLE( "XOrderTouch::unlocked=%s", C2SZ(idsTarget) );
		}
	}
	if( numFounds == m_spProp->m_aryIdsTarget.size() ) {
		m_bControled = true;
	}
	return m_bControled;
}
Пример #30
0
void XOrderIndicate::OnCreate()
{
	// 터치를 허용하는 윈도우들의 목록처리
	if( m_spProp->m_aryIdsAllow.size() > 0 ) {
		for( auto& idsAllow : m_spProp->m_aryIdsAllow ) {
			if( !idsAllow.empty() ) {
				GAME->SetActive( true );
				GAME->AddidsAllowWnd( idsAllow );
				CreateIndicator( idsAllow );
			}
		}
	}
	if( m_spProp->m_aryIdsTarget.size() ) {
		// 타겟리스트가 있을때
		bool bFound = false;
		for( auto& idsTarget : m_spProp->m_aryIdsTarget ) {
			if( !idsTarget.empty() ) {
				// 각타겟에 인디케이터를 생성한다.
				bFound = CreateIndicator();
			} else {
				CONSOLE( "%s:ids_target(%s)찾을수 없음.", __TFUNC__, C2SZ(idsTarget) );
			}
		}
		if( !bFound )
			m_timerSec.Set( 1.f );	// 1초에 한번씩 재검색하기 위해
		// 아직 창이 안떳다든가 하는이유로 타겟팅에 실패하면 process에서 다시 찾는다.
		if( m_spProp->m_typeEnd == xFIN_PUSH_TARGET ) {
			GAME->SetActive( true );	// 입력을 모두 풀고
			GAME->AddidsAllowWnd( m_spProp->m_aryIdsTarget );
		}
	} else {
		// end조건이 order_complete이면 좌표가 반드시 있어야 한다.(뭔가 이상하군)
		XBREAK( m_spProp->m_typeEnd != xFIN_ORDER_COMPLETE && m_spProp->m_vPos.IsZero() );
		if( m_spProp->m_secLife > 0 ) {
			m_timerFinish.Set( m_spProp->m_secLife );
		} else {
// 			if( m_spProp->m_aryIdsTarget.size() == 0 )
// 				m_timerFinish.Set( 10.f );	// 타겟이 없는 화살표는 10초후에 자동으로 종료된다.
		}
		if( m_spProp->m_idsRoot.empty() )
			CreateSpr( m_spProp->m_vPos, GAME->GetpScene(), XE::VEC2(0) );
		else {
			XWnd *pRoot = GAME->Find( m_spProp->m_idsRoot );
			if( XASSERT( pRoot ) ) {
				CreateSpr( pRoot, m_spProp->m_idsRoot );
			}
// 				CreateSpr( m_spProp->m_vPos, pRoot, std::string() );
		}
	}
	if( m_spProp->m_typeEnd == xFIN_ORDER_COMPLETE ) {
		GAME->SetActive( true );
	}
}