Beispiel #1
0
void dmnUtils::HandleException(const std::exception& x)
{
    wstringstream msgStream;
    msgStream << L"An exception caught in CodeXL Daemon. Exception Message = ";
    msgStream << x.what();
    gtString msgString(msgStream.str().c_str());
    OS_OUTPUT_DEBUG_LOG(msgString.asCharArray(), OS_DEBUG_LOG_ERROR);
}
Beispiel #2
0
bool alAuditData(unsigned typeLen, char const * type, unsigned msgLen, char const * msg, unsigned dataLen, void const * dataBlock)
{
    StringBuffer typeString(typeLen, type);
    typeString.toUpperCase();
    StringBuffer msgString(msgLen, msg);
    AuditType typeValue = findAuditType(typeString.str());
    if(typeValue >= NUM_AUDIT_TYPES)
        return false;
    return AUDIT(typeValue, msgString.str(), dataLen, dataBlock);
}
Beispiel #3
0
void
Exception::setMsg( const char *file, const char *line, const char *message )
{
    std::string msgString(message);
    message_ =  "\n *** ERROR(";
    message_ += basename(file);
    message_ += ":";
    message_ += line;
    message_ += +"): " + msgString + "\n";
}
Beispiel #4
0
void Message2( char *fmt, ... )
{
    va_list     args;
    char        tmp[MAX_STR];

    va_start( args, fmt );
    MyVSprintf( tmp, fmt, args );
    va_end( args );
    strcpy( msgString2, tmp );
    msgString( 2, tmp );
}
Beispiel #5
0
void Message1( char *fmt, ... )
{
    va_list     args;
    char        tmp[MAX_STR];

    ClearWindow( MessageWindow );
    va_start( args, fmt );
    MyVSprintf( tmp, fmt, args );
    va_end( args );
    strcpy( msgString1, tmp );
    msgString( 1, tmp );
}
Beispiel #6
0
WINEXPORT LRESULT CALLBACK MessageWindowProc( HWND hwnd, UINT msg, WPARAM w, LPARAM l )
{
    PAINTSTRUCT ps;

    switch( msg ) {
    case WM_CREATE:
        SET_WNDINFO( hwnd, (LONG_PTR)&MessageBar );
        break;
    case WM_PAINT:
        BeginPaint( hwnd, &ps );
        if( !BAD_ID( MessageWindow ) ) {
            msgString( 1, msgString1 );
            msgString( 2, msgString2 );
        }
        EndPaint( hwnd, &ps );
        return( 0 );
    case WM_SETFOCUS:
        SetFocus( Root );
        return( 0 );
    }
    return( DefWindowProc( hwnd, msg, w, l ) );
}
Beispiel #7
0
void UI::handleCommand(const std::string &command) {

	std::pair<std::string::size_type, std::string::size_type> pos
		= nextToken(command);
	std::string::size_type len = pos.second - pos.first;

	if (!len) {
		return;
	}

	std::string data(command, pos.first, len);

	if (len == 1 && data == "/" && command.length() > 2) {
		pos.first += 2;
		goto chatmsg;
	}

	if (command[pos.first] != '/') {
	chatmsg:
		if (! chatNetwork.length()) {
			messageW->printf("Message not sent, use /chat or /msg command\n");
			messageW->refresh();
			return;
		}

		if (! userExists(chatUser, chatNetwork)) {
			messageW->printf("Message not sent, user not found\n");
			messageW->refresh();
			return;
		}

		sendSignal("/net/msg/send", chatNetwork,
				   new sig::MessageData(chatUser,
									std::string(command, pos.first), 0));

	}

	if (len == 5 && (data == "/quit" || data == "/exit")) {
		sendSignal("/core/module/exits", Core::coreName);
		return;
	}

	if ((len == 2 && (data == "/n" || data == ":n"))
	|| (len == 6 && data == "/names")) {
		/* /names command */
		if (networkUsers.empty()) {
			messageW->printf("There are no connected networks\n");
		} else {
			NetworkUsers::iterator nuit;
			sig::UsersListData::Users::iterator uit;
			for(nuit=networkUsers.begin(); nuit!=networkUsers.end(); ++nuit) {
				if (nuit->second->users.empty()) {
					messageW->printf("Network %s has no connected users\n",
					                 nuit->first.c_str());
				} else {
					messageW->printf("Connected users in network %s:\n",
					                 nuit->first.c_str());
					for(uit=nuit->second->users.begin();
					    uit!=nuit->second->users.end();
					    ++uit) {
						messageW->printf("%s (%s) (%s)\n",
						          uit->second->name.c_str(),
						          uit->first.toString().c_str(),
						          uit->second->status.toString().c_str()
						);
					}
				}
			}
		}
	}

	if (len == 5 && data == "/chat") {

		/* trim */
		pos = nextToken(command, pos.second);
		if (pos.first == std::string::npos) {
			/* end chat */
			messageW->printf("Chat with %s (network %s) finished\n",
			                chatUser.toString().c_str(),
							chatNetwork.c_str());
			chatNetwork.clear();
			statusW->printf("\n");
			statusW->refresh();
			return;
		}

		std::string userString(command, pos.first, pos.second-pos.first);

		std::multimap< std::string, User* >::iterator it;
		findUsers(userString);

		if(usersFound.size() == 0) {
			messageW->printf("No users match to '%s', try /names command.\n", userString.c_str());
		} else if(usersFound.size() > 1) {
			int iii;
			messageW->printf("Ambiguous user '%s', possible matches:\n",
			                 userString.c_str());
			for(iii=1, it=usersFound.begin(); it!=usersFound.end(); ++iii, ++it) {
				messageW->printf("[#%d] %s\n", iii, it->second->id.toString().c_str());
			}
			completionModeEnter();
		} else {

			it = usersFound.begin();
			chatUser = it->second->id;
			chatNetwork = it->first;
			messageW->printf("Chatting with %s (network %s)\n",
			                 chatUser.toString().c_str(),
							 chatNetwork.c_str());
			statusW->printf("Chatting with %s (network %s)\n",
			                 chatUser.toString().c_str(),
							 chatNetwork.c_str());
			statusW->refresh();
		}
		messageW->refresh();
	}

	if ((len == 4 && data == "/msg") ||
	    (len == 3 && data == "/me")) {
		/* if len == 0 then data == "/" */

		/* trim */
		pos = nextToken(command, pos.second);
		if (pos.first == std::string::npos) {
			/* refuse to send empty line */
			return;
		}

		std::string userString(command, pos.first, pos.second-pos.first);
		pos = nextToken(command, pos.second);
		if (pos.first == std::string::npos) {
			/* no message? */
			return;
		}
		std::string msgString(command, pos.first, pos.second-pos.first);

		std::multimap< std::string, User* >::iterator it;
		findUsers(userString);

		if(usersFound.size() == 0) {
			messageW->printf("No users match to '%s', try /names command.\n", userString.c_str());
		} else if(usersFound.size() > 1) {
			int iii;
			messageW->printf("Ambiguous user '%s', possible matches:\n",
			                 userString.c_str());
			for(iii=1, it=usersFound.begin(); it!=usersFound.end(); ++iii, ++it) {
				messageW->printf("[#%d] %s\n", iii, it->second->id.toString().c_str());
			}
			completionModeEnter();
		} else {

			it = usersFound.begin();
			std::string net = it->first;
			sendSignal("/net/msg/send", net,
			           new sig::MessageData(it->second->id,
		                                std::string(command, pos.first),
		                                len==3?sig::MessageData::ACTION:0));
		}

	} else if (len == 3 && data == "/aw") {
		/* dirty trick */
		pos.second = pos.first + 1;
		goto status;

	} else if (len == 7 && data == "/status") {
	status:
		enum User::State state;
		bool valid;

		pos = nextToken(command, pos.second);
		if (pos.first == std::string::npos) {
			return;
		}

		data.assign(command, pos.first, pos.second - pos.first);
		state = User::getState(data, valid);
		if (!valid) {
			return;
		}

		/* send to all networks */
		std::string net = "/net/";
		pos = nextToken(command, pos.second);
		if (pos.first == std::string::npos) {
			data.clear();
		} else {
			data.assign(command, pos.first, std::string::npos);
		}

		/*
		 * in UserData we must supply valid data only for these
		 * information which has changed (status and/or displayname)
		 */
		sendSignal("/net/status/change", net,
		           new sig::UserData(User("dummy", Address(),
		                                  User::Status(state, data)),
		                             sig::UserData::STATE |
		                             sig::UserData::MESSAGE));
	} else if((len == 3 && data == "/dn")
	|| (len = 12 && data == "/displayname")) {



	} else if(len == 8 && data == "/history") {
		std::list<std::string>::iterator hi;
		int i;

		messageW->printf("Command history:\n");
		for(hi=history.begin(), ++hi, i=1; hi!=history.end(); ++hi, ++i) {
			messageW->printf("[%2d] %s\n", i, hi->c_str());
		}
		messageW->refresh();


	/* ... and so it may go with other commands */
	} else {
		/* print error message -- unkonw command */
	}
}
Beispiel #8
0
void dmnUtils::LogMessage(const std::wstring& msg, osDebugLogSeverity severity)
{
    gtString msgString(msg.c_str());
    OS_OUTPUT_DEBUG_LOG(msgString.asCharArray(), severity);
}
Beispiel #9
0
   void OrbSysGpsC_30::loadData(const PackedNavBits& msg)
      throw(InvalidParameter)
   {
      setUID(msg);
      if (UID!=30)
      {
         char errStr[80];
         std::string msgString("Expected GPS CNAV MT 30.  Found unique ID ");
         msgString += StringUtils::asString(UID);
         InvalidParameter exc(msgString);
         GPSTK_THROW(exc);    
      } 
      obsID        = msg.getobsID();
      satID        = msg.getsatSys();
      beginValid   = msg.getTransmitTime();

           // Message Type 30 data
      unsigned long testAvail = 4096;    // Pattern in message of 0x1000
                                         // if data quantity not available
                                          
      unsigned long avail = msg.asUnsignedLong(127,13,1);
      avail_Tgd = false;
      if (avail!=testAvail)
      {
         avail_Tgd = true;
         Tgd       = msg.asSignedDouble(127, 13, -35);
      }

      avail = msg.asUnsignedLong(140,13,1);
      avail_L1CA = false;
      if (avail!=testAvail)
      {
         avail_L1CA = true;
         ISC_L1CA  = msg.asSignedDouble(140, 13, -35);
      }
      
      avail = msg.asUnsignedLong(153,13,1);
      avail_L2C = false;
      if (avail!=testAvail)
      {
         avail_L2C = true;
         ISC_L2C   = msg.asSignedDouble(153, 13, -35);
      }
      
      avail = msg.asUnsignedLong(166,13,1);
      avail_L5I5 = false;
      if (avail!=testAvail)
      {
         avail_L5I5 = true;
         ISC_L5I5  = msg.asSignedDouble(166, 13, -35);
      }

      avail = msg.asUnsignedLong(179,13,1);
      avail_L5Q5 = false;
      if (avail!=testAvail)
      {
         avail_L5Q5 = true;
         ISC_L5Q5  = msg.asSignedDouble(179, 13, -35);
      }

      alpha[0] = msg.asSignedDouble(192, 8, -30);
      alpha[1] = msg.asSignedDouble(200, 8, -27);
      alpha[2] = msg.asSignedDouble(208, 8, -24);
      alpha[3] = msg.asSignedDouble(216, 8, -24);
      beta[0]  = msg.asSignedDouble(224, 8,  11);
      beta[1]  = msg.asSignedDouble(232, 8,  14);
      beta[2]  = msg.asSignedDouble(240, 8,  16);
      beta[3]  = msg.asSignedDouble(248, 8,  16);

         // Need to convert from sec/semi-circle to sec/rad
      double conversion = 1.0 / PI; 
      alpha[1] *= conversion;
      beta[1]  *= conversion;
      alpha[2] *= conversion * conversion;
      beta[2]  *= conversion * conversion;
      alpha[3] *= conversion * conversion * conversion;
      beta[3]  *= conversion * conversion * conversion;

      dataLoadedFlag = true;   
   } // end of loadData()