Пример #1
0
char *L2PNet_inet_ntoa( struct in_addr in )
{
	char b[10];
	char *p = l2pnet_static_inet_ntoa_buffer;
	_itoa( in.S_un.S_addr & 0xFF, b, 10 );
	strcpy( p, b );
	_itoa( (in.S_un.S_addr >> 8) & 0xFF, b, 10 );
	strcat( p, "." );
	strcat( p, b );
	_itoa( (in.S_un.S_addr >> 16) & 0xFF, b, 10 );
	strcat( p, "." );
	strcat( p, b );
	_itoa( (in.S_un.S_addr >> 24) & 0xFF, b, 10 );
	strcat( p, "." );
	strcat( p, b );

    return l2pnet_static_inet_ntoa_buffer;
}
Пример #2
0
void CDiagRec::setNTError(DWORD errorMsgLang, const char *FuncName)
{
	LPVOID	lpMsgBuf;
	DWORD	error;
	char	buffer[10];

	error = GetLastError();
	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
				NULL,
				error,
				errorMsgLang,
				(LPTSTR) &lpMsgBuf,
				0,
				NULL);
	setDiagRec(DRIVER_ERROR, IDS_NT_ERROR, error, (char *)lpMsgBuf, NULL, 
		SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 2, FuncName, _itoa(error,buffer,10));
	LocalFree(lpMsgBuf);
}
Пример #3
0
Файл: lcd.c Проект: sshakuf/mdop
void LCDPrintNumWithPoint(UCHAR inX, UCHAR inY, UCHAR inNum) // prints a int to the screen. convert the int to string and prints it with Point in the middle
{

	char str[4];
	_itoa(inNum, &str[0], 10);
	if (inNum < 10)
	{
		LCDPutNum(inX, inY, 0);
		LCDPutChar(inX + 1, inY, LCD_POINT);
		LCDPutNum(inX + 2, inY, str[0]-48);
	}
	else
	{
		LCDPutNum(inX, inY, str[0]-48);
		LCDPutChar(inX + 1, inY, LCD_POINT);
		LCDPutNum(inX + 2, inY, str[1]-48);
	}
}
Пример #4
0
void BK16USODevice::init(unsigned char* frame)
{
	if (Debug::BK16_DEBUG_OUT){
		char str[800];
		std::cout << "BK16USODevice::init ";
		for (int i = 0; i < frame[3] + frame[4] * 256 + 7; i++)
			std::cout << _itoa(frame[i], str, 16) << " ";
		std::cout << std::endl;
	}

	fInit = true;

	frame[0] = frame[1];
	frame[1] = address;
	frame[2] = COMMAND_INIT;
	frame[3] = 0;
	frame[4] = 0;
}
Пример #5
0
/// <summary>
/// Constructor with integer initialization
/// </summary>
/// <param name="integer_value">Integer value for the initialization</param>
CLargeInteger::CLargeInteger( const int integer_value )
{
    // convert integer value to char array
    char ch_value[64] = {0};
    char *ptr = _itoa(integer_value, ch_value, 10);

    // Sign check 
    fSign = ( integer_value < 0 ) ? -1    : 1;
    ptr   = ( integer_value < 0 ) ? ++ptr : ptr;
    
    // Copy char array
    fpchNumber_len = strlen(ptr);
    fpchNumber = (char*) calloc (fpchNumber_len + 1, 1);
    strcpy(fpchNumber, ptr);

    // initialization of value for printable array 
    fpchPrintableVal = 0;
}
Пример #6
0
void HISTORY::registerBookmarkSet(int slot, BOOKMARK& backupCopy, int oldCurrentBranch)
{
	// create new snapshot
	SNAPSHOT snap;
	snap.init(currMovieData, taseditorConfig.enableHotChanges);
	// fill description: modification type + keyframe of the Bookmark
	snap.modificationType = MODTYPE_BOOKMARK_0 + slot;
	strcat(snap.description, modCaptions[snap.modificationType]);
	snap.startFrame = snap.endFrame = snap.keyFrame = bookmarks.bookmarksArray[slot].snapshot.keyFrame;
	char framenum[11];
	strcat(snap.description, " ");
	_itoa(snap.keyFrame, framenum, 10);
	strcat(snap.description, framenum);
	if (taseditorConfig.enableHotChanges)
		snap.inputlog.copyHotChanges(&getCurrentSnapshot().inputlog);
	addItemToHistoryLog(snap, oldCurrentBranch, backupCopy);
	project.setProjectChanged();
}
Пример #7
0
wchar_t * __cdecl _itow (
        int val,
        wchar_t *buf,
        int radix
        )
{
        char astring[INT_SIZE_LENGTH];

        _itoa (val, astring, radix);
#if defined(_NTSUBSET_)
        mbstowcs(buf, astring, INT_SIZE_LENGTH);
#else
        MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, astring, -1,
                            buf, INT_SIZE_LENGTH);
#endif

        return (buf);
}
Пример #8
0
int FileSystem::writeFS( Inode inode )
{
	int dataBlockNum = searchUnassignedBlockNum(); // 데이터블럭 번호 할당
	int inodeNum = searchUnassignedInodeNum(); // 아이노드 번호 할당

	char *buffer = new char[2];
	_itoa( dataBlockNum, buffer );

	int inodeBlockNum = checkInodeBlockNum( inodeNum ); // 아이노드 번호가 32이상인지 확인

	if ( inodeBlockNum == 4 ) // 아이노드 번호가 32이하 이면 블럭번호 4에 저장
	{
		inodeBlock[0].setMode( inodeNum, inode.mode );
		inodeBlock[0].setSize( inodeNum, inode.size );
		inodeBlock[0].setTime( inodeNum, inode.time );
		inodeBlock[0].setCtime( inodeNum, inode.ctime );
		inodeBlock[0].setMtime( inodeNum, inode.mtime );
		inodeBlock[0].setLinksCount( inodeNum, inode.linksCount );
		inodeBlock[0].setBlocks( inodeNum, inode.blocks );
		inodeBlock[0].setDataBlockList( inodeNum, buffer );
	}

	else if ( inodeBlockNum == 5 ) // 이상이면 블럭번호 5에 저장
	{
		inodeBlock[1].setMode( inodeNum - 32, inode.mode );
		inodeBlock[1].setSize( inodeNum - 32, inode.size );
		inodeBlock[1].setTime( inodeNum - 32, inode.time );
		inodeBlock[1].setCtime( inodeNum - 32, inode.ctime );
		inodeBlock[1].setMtime( inodeNum - 32, inode.mtime );
		inodeBlock[1].setLinksCount( inodeNum - 32, inode.linksCount );
		inodeBlock[1].setBlocks( inodeNum - 32, inode.blocks );
		inodeBlock[1].setDataBlockList( inodeNum - 32, buffer );
	}

	blockBitmap[dataBlockNum] = '1'; // 블럭 비트맵 갱신
	inodeBitmap[inodeNum] = '1'; // 아이노드 비트맵 갱신

	blockDescriptorTable.setUnassignedBlockNum( atoi( blockDescriptorTable.getUnassignedBlockNum() ) - 1 ); // unassignedBlockNum - 1 
	blockDescriptorTable.setUnassignedInodeNum( atoi( blockDescriptorTable.getUnassignedInodeNum() ) - 1 ); // unassignedInodeNum - 1

	delete[] buffer;

	return inodeNum;
}
Пример #9
0
extern "C" void odbc_SQLSvc_EndTransaction_ccf_ (
    CEE_tag_def cmptag_
  , const struct odbc_SQLSvc_EndTransaction_exc_ *exception_
  , const ERROR_DESC_LIST_def *sqlWarning
  )
{

	SRVR_CALL_CONTEXT	*srvrCallContext = (SRVR_CALL_CONTEXT *)cmptag_;
	CConnect			*pConnection = (CConnect *)srvrCallContext->sqlHandle;

	pConnection->setExceptionErrors(exception_->exception_nr, exception_->exception_detail);
	switch (exception_->exception_nr)
	{
		case CEE_SUCCESS:
			if (sqlWarning->_length > 0)
				pConnection->setDiagRec(sqlWarning);
			break;
		case odbc_SQLSvc_EndTransaction_SQLError_exn_:
			pConnection->setDiagRec(&exception_->u.SQLError);
			break;
		case odbc_SQLSvc_EndTransaction_ParamError_exn_:
			pConnection->setDiagRec(SERVER_ERROR, IDS_PROGRAM_ERROR, exception_->exception_nr, 
					exception_->u.ParamError.ParamDesc, NULL, 
					SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1, pConnection->getSrvrIdentity());
			break;
		case odbc_SQLSvc_EndTransaction_SQLInvalidHandle_exn_:
			break;
		case odbc_SQLSvc_EndTransaction_InvalidConnection_exn_:
			pConnection->setDiagRec(SERVER_ERROR, IDS_08_S01);
			break;
		case odbc_SQLSvc_EndTransaction_TransactionError_exn_:
			char tmpNumBuffer[16];
			_itoa (exception_->exception_detail, tmpNumBuffer, 10);
			pConnection->setDiagRec(SERVER_ERROR, IDS_TRANSACTION_ERROR, exception_->exception_nr,
						tmpNumBuffer, NULL, SQL_ROW_NUMBER_UNKNOWN, SQL_COLUMN_NUMBER_UNKNOWN, 1, pConnection->getSrvrIdentity());
			break;
		default:
			pConnection->sendCDInfo(exception_->exception_nr);
			pConnection->setDiagRec(exception_->exception_nr, ENDTRANSACT_PROCNAME,
					pConnection->getSrvrIdentity());
			break;
	}

} // odbc_SQLSvc_EndTransaction_ccf_()
Пример #10
0
//Protocol chain is list of integers "0".."n", with network protocol named "p"
INT_PTR Proto_CallContactService(WPARAM wParam,LPARAM lParam)
//note that this is ChainSend() too, due to a quirk of function definitions
{
	CCSDATA *ccs=(CCSDATA*)lParam;
	int i;
	char str[10];
	DBVARIANT dbv;
	INT_PTR ret;
	PROTOACCOUNT* pa;

	if ( wParam == (WPARAM)(-1))
		return 1;

	for ( i = wParam;; i++ ) {
		_itoa( i, str, 10 );
		if ( DBGetContactSettingString( ccs->hContact, "_Filter", str, &dbv ))
			break;

		if (( ret = CallProtoService( dbv.pszVal, ccs->szProtoService, i+1, lParam )) != CALLSERVICE_NOTFOUND ) {
			//chain was started, exit
			mir_free( dbv.pszVal );
			return ret;
		}
		mir_free( dbv.pszVal );
	}
	if ( DBGetContactSettingString( ccs->hContact, "Protocol", "p", &dbv ))
		return 1;

	pa = Proto_GetAccount( dbv.pszVal );
	if ( pa == NULL || pa->ppro == NULL )
		ret = 1;
	else {
		if ( pa->bOldProto )
			ret = CallProtoServiceInt( ccs->hContact, dbv.pszVal, ccs->szProtoService, (WPARAM)(-1), ( LPARAM)ccs );
		else
			ret = CallProtoServiceInt( ccs->hContact, dbv.pszVal, ccs->szProtoService, ccs->wParam, ccs->lParam );
		if ( ret == CALLSERVICE_NOTFOUND )
			ret = 1;
	}

	mir_free(dbv.pszVal);
	return ret;
}
Пример #11
0
int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR **proto, int protoCnt, int Pos)
{
	char buf[10];
	_itoa(Pos, buf, 10);

	DBVARIANT dbv;
	if (!db_get_s(NULL, "Protocols", buf, &dbv)) {
		for (int p = 0; p < protoCnt; p++) {
			if (mir_strcmp(proto[p]->szName, dbv.pszVal) == 0) {
				db_free(&dbv);
				return p;
			}
		}

		db_free(&dbv);
	}

	return -1;
}
Пример #12
0
char* number (int x)
{
		int i, j, k;
		char buff[16];
		static char string[12] = "           ";

		_itoa (x, buff, 10);
		k = strlen (buff);
		i = k + (k-1)/3;
		string[i--] = 0;
		j = 0;
		while (1)
		{
			string[i--] = buff[--k];
			if (i < 0) break;
			if (++j % 3 == 0) string[i--] = ',';
		}
		return (string);
}
Пример #13
0
//
// Strings can be appended with short integers
//
	inline FixedLengthString& operator << (short int Value)
	{
		char Source[30];
		
		_itoa(Value, Source, 10);

		int Length=strlen(Source)+1;

		if( CurrentSize+Length>MaximumLength )
			Length=MaximumLength-CurrentSize;

		memcpy( Text+CurrentSize, Source, Length );

		CurrentSize+=Length-1;

		*(Text+CurrentSize)=0;

		return *this;
	}
Пример #14
0
void Exporter::validateData()
{
	info += "\r\n";

	removeRedundantMaterials();
	buildBoneHierarchy();

	// Calculate bone id (prevents mixing wrong types)
	boneId = 0;
	for(unsigned int i = 0; i < bones.size(); ++i)
	{
		// Sum of child index * parent index
		for(unsigned int j = 0; j < i; ++j)
		if(bones[i].getParentName() == bones[j].getName())
			boneId += i*j;
	}

	if(model.getObjects().size() > 1)
	{
		model.buildObjectHierarchy();
		printInfo("Resorted object hierarchy");
	}

	if(model.getHelpers().size() > 1)
	{
		model.buildHelperHierarchy();
		printInfo("Resorted helper hierarchy");
	}

	if(boneId >= 0)
	{
		char number[20] = { 0 };
		_itoa(boneId, number, 10);

		info += "\r\n";
		printInfo("Calculated bone id: " + std::string(number));
	}

	model.setCollisionFlags();
	// !!!!!!!!!!!!!!!!!!
	//if(boneId <= 0)
	//	model.chopObjects();
}
Пример #15
0
	void CreateDumbyFiles(const std::string& name, int numFiles, int numKBytes)
	{
		if(numFiles <= 0 || numKBytes <= 0)
			return;

		std::stringstream ss;
		ss << name << "_" << numKBytes << "KB_File_";

		char* temp = new char[numKBytes * 1024];
		char buff[33];

		for(int i = 0; i < numFiles; ++i)
		{
			_itoa(i + 1, buff, 10);
			std::ofstream file(ss.str() + buff + ".dat", std::ios::out | std::ios::trunc);
			file.write(temp, numKBytes * 1024);
			file.close();
		}
	}
Пример #16
0
int makestr(char *type,char *data,char *rtdata)
{   size_t i=0;
	char *s=new char[4]; 
	char str[200]="";
	char *temp=rtdata;
	i=strlen(data);
    _itoa((int)i,s,10);
	i=i+strlen(s)+2;
	strcat(str,":");
	strcat(str,type);
	strcat(str,s);
	strcat(str,":");
	strcat(str,data);
	strncpy(temp,str,strlen(str));
	temp[i+1]='\0';
	delete [] s;
	return 0;

}
Пример #17
0
//结构体初始化 位域操作
void main()
{
	struct _tagStruct1
	{
		int a = 1;
		int b = 2;
	} istr1;
//	istr1.a = 2;
	printf("结构体=%d\n", istr1.a);

	struct _tagStruct2
	{
		int a : 1;
		int b : 2;
	} istr2;
	istr2.a = 1;
	printf("结构体=%d\n", istr2.a);

	typedef struct  AA
	{
		unsigned char b1 : 5;
		unsigned char b2 : 5;
		unsigned char b3 : 5;
		unsigned char b4 : 5;
		unsigned char b5 : 5;
	}AA1;
	struct test1
	{
		char a : 1;
		char : 2;
		long b : 3;
		char c : 2;
	}AA;//12

	printf("daxiao = %d",sizeof(AA));// 但实际上只用了25位,即4个字节,

	int number = 12345;
	char string[25];

	_itoa(number, string, 2);
	printf("integer = %d string = %s\n", number, string);
	def_connect(2);
}
string CGnutellaFileTransferDlg::FormatWithCommas(unsigned int num)
{
	string ret;

	char buf[32];
	char buf2[sizeof(buf)*2];
	memset(buf,0,sizeof(buf));
	memset(buf2,0,sizeof(buf2));

	_itoa(num,buf,10);

	char *ptr=&buf[strlen(buf)-1];	// last char
	char *ptr2=&buf2[sizeof(buf2)-2];	// last char
	int i=0;
	while(1)
	{
		if(i>0)
		{
			if(i%3==0)
			{
				*ptr2=',';
				ptr2--;
			}
		}

		*ptr2=*ptr;

		if(ptr==buf)
		{
			break;
		}

		ptr--;
		ptr2--;
		i++;
	}
	*ptr2=*ptr;
	
	ret=ptr2;

	return ret;
}
Пример #19
0
NoiseSockets::NoiseSockets(HWND hwnd,CCriticalSection *connection_data_critical_section,vector<ConnectionData> *connection_data,FileSharingManager* fsm)
{
	p_fs_manager = fsm;
	m_hwnd=hwnd;
	p_connection_data_critical_section=connection_data_critical_section;
	p_connection_data=connection_data;

	m_num_bogus_connections=0;
	m_num_good_connections=0;

	int num_reserved_events=ReturnNumberOfReservedEvents();
	int num_socket_events=ReturnNumberOfSocketEvents();

	// Init the parent pointers and message window handles
	for(int i=0;i<num_socket_events;i++)
	{
		m_sockets[i].InitParent(this);
	}
	
	// Create the reserved events
	for(i=0;i<num_reserved_events;i++)
	{
		m_events[i]=WSACreateEvent();
		if(m_events[i]==WSA_INVALID_EVENT)
		{
			char msg[1024];
			strcpy(msg,"Could not create a valid reserved event ");
			_itoa(i,&msg[strlen(msg)],10);
			::MessageBox(NULL,msg,"Error",MB_OK);
		}
	}

	// Fully initialize events array
	for(i=0;i<num_socket_events;i++)
	{
		m_events[num_reserved_events+i]=m_sockets[i].ReturnEventHandle();
	}

	p_noise_data_buf=NULL;
	
	InitNoiseData();
}
Пример #20
0
void bta_sys_prompt(NPP instance, const char *error) {
	struct _bta_prompt_info *p = (struct _bta_prompt_info *)bta_malloc(sizeof(struct _bta_prompt_info)+strlen(error)+1);

	_bta_sys_info = p;
	p->pin = ((bta_info *)instance->pdata)->pin;
	p->parent= ((bta_info*)instance->pdata)->window;
	strcpy_s(p->error, strlen(error)+1, error);
	p->instance=instance;

	HINSTANCE hinstance = (HINSTANCE)GetWindowLong(p->parent, GWL_HINSTANCE);

	p->hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); 
	p->cursor[0]=LoadCursor(NULL, IDC_ARROW);
	p->cursor[1]=LoadCursor(NULL, IDC_IBEAM);

	WNDCLASS wndclass;
	if( GetClassInfo(hinstance, L"BetterThanAdsPrompt", &wndclass)==0 ) {
		wndclass.lpszClassName=L"BetterThanAdsPrompt";
		wndclass.lpszMenuName=NULL;
		wndclass.cbClsExtra=0;
		wndclass.cbWndExtra=0;
		wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); 
		wndclass.hCursor=p->cursor[0];
		wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
		wndclass.lpfnWndProc=_bta_sys_prompt_callback;
		wndclass.style=CS_HREDRAW|CS_VREDRAW;

		wndclass.hInstance=hinstance;

		if( !RegisterClass(&wndclass) ) {
			char ibuf[20];
			_itoa(GetLastError(),ibuf,10);
			logmsg("ERROR registering window class!\n   Error code: ");
			logmsg(ibuf);
			logmsg("\n");
			return;
		}
	}

	DWORD threadid;
	HANDLE promptThreadHandle = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)_bta_sys_prompt, p, 0, &threadid);
}
Пример #21
0
  THRCOMP ThGenIps(_anchor proc_anchor)
{
  void *ptr;
  char *p;
  char string[256];
  int value, i;
  long size, count;
  char *type;
  port_ent port_tab[3];
  //char buffer[256];

  value = dfsdfpt(proc_anchor, 3, port_tab,"COUNT","OUT","PREFIX");

  value = dfsrecv(proc_anchor, &ptr, &port_tab[0], 0, &size, &type);
  if (value > 0) {
     printf("THGENIPS: No number specified\n");
  //   dfsputs(proc_anchor, buffer);
     return(8);
     }
  memcpy(string,ptr,size);
  string[size] = '\0';
  count = atol(string);

  value = dfsdrop(proc_anchor, &ptr);

  strcpy(string, "Testing ");
  value = dfsrecv(proc_anchor, &ptr, &port_tab[2], 0, &size, &type);
  if (value == 0) {
     memcpy(string,ptr,size);
     string[size] = '\0';
     value = dfsdrop(proc_anchor, &ptr);
  }
 // dfstest(proc_anchor);
  for (i = 0; i < count; i++) {
      value = dfscrep(proc_anchor, &ptr, 32,"G");
      strcpy((char *) ptr, string);
      p = strchr((char *) ptr, '\0');
      _itoa(i, p, 10);
      value = dfssend(proc_anchor, &ptr, &port_tab[1], 0);
      }
  return(0);
} 
Пример #22
0
static bool BuildConnStr ( char* pStrConn, Word pMaxLen, pODBCConn pConn, struct ODBCKV* KVInput,
                           Word iKVInputPairs, struct ODBCKV* KVFileDSN, Word iKVFileDSNPairs ) {
    Word    iPos = 0;
    Char    p[32];                              // arbitary for string port number as string
    // initializations
    memset ( pStrConn, 0, pMaxLen );
    // convert port number to string
    _itoa ( pConn->ServerPort, p, 10 );
    
    // transfer all strings from struct
    if ( !AddKVToConnStr ( "DRIVER", "{KylinODBCDriver}", &iPos, pStrConn, pMaxLen ) ) {
        __ODBCLOG ( _ODBCLogMsg ( LogLevel_DEBUG, "AddKVToConnStr failed in %s", "Driver" ) );
        return FALSE;
    }
    
    if ( !AddKVToConnStr ( "SERVER", pConn->Server, &iPos, pStrConn, pMaxLen ) ) {
        __ODBCLOG ( _ODBCLogMsg ( LogLevel_DEBUG, "AddKVToConnStr failed in %s", "Server" ) );
        return FALSE;
    }
    
    if ( !AddKVToConnStr ( "PROJECT", pConn->Project, &iPos, pStrConn, pMaxLen ) ) {
        __ODBCLOG ( _ODBCLogMsg ( LogLevel_DEBUG, "AddKVToConnStr failed in %s", "Project" ) );
        return FALSE;
    }
    
    if ( !AddKVToConnStr ( "PORT", p, &iPos, pStrConn, pMaxLen ) ) {
        __ODBCLOG ( _ODBCLogMsg ( LogLevel_DEBUG, "AddKVToConnStr failed in %s", "Port" ) );
        return FALSE;
    }
    
    if ( !AddKVToConnStr ( "UID", pConn->UserName, &iPos, pStrConn, pMaxLen ) ) {
        __ODBCLOG ( _ODBCLogMsg ( LogLevel_DEBUG, "AddKVToConnStr failed in %s", "Uid" ) );
        return FALSE;
    }
    
    if ( !AddKVToConnStr ( "PWD", pConn->Password, &iPos, pStrConn, pMaxLen ) ) {
        __ODBCLOG ( _ODBCLogMsg ( LogLevel_DEBUG, "AddKVToConnStr failed in %s", "Pwd" ) );
        return FALSE;
    }
    
    return TRUE;
}
void MultiCursorAppCpp::initGL(int argc, char* argv[])
{
	glutInit(&argc, argv);

	WinIDs = new int[TKinect2Display.size()];
	for (size_t i = 0; i < TKinect2Display.size(); ++i)
	{
		glutInitWindowPosition(i*20, 0);
		//glutInitWindowPosition(windowOffsetX[i], 0);
		glutInitWindowSize(VEC_WIN_WIDTH[i], VEC_WIN_HEIGHT[i]);

		glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
		char winName[8];
		_itoa((int)i, winName, 10);
		WinIDs[i] = glutCreateWindow(winName);

		//// Register callback functions
		//glutReshapeFunc(sreshape);
		glutDisplayFunc(sdisplay);
		glutIdleFunc(sidle);
		glutKeyboardFunc(skeyboard);
		glutMouseFunc(smouse);

		glClearColor(1.0, 1.0, 1.0, 1.0);

		/* Camera setup */
		glViewport(0, 0, kinectBasics.widthDepth, kinectBasics.heightDepth);
		glLoadIdentity();

		if (i == 0){
			/* GLのウィンドウをフルスクリーンに */
			//GLのデバイスコンテキストハンドル取得
			glutSetWindow(WinIDs[i]);
			HDC glDc = wglGetCurrentDC();
			//ウィンドウハンドル取得
			HWND hWnd = WindowFromDC(glDc);
			//ウィンドウの属性と位置変更
			SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
			SetWindowPos(hWnd, HWND_TOP, windowOffsetX[i], 0, VEC_WIN_WIDTH[i], VEC_WIN_HEIGHT[i], SWP_SHOWWINDOW);
		}
	}
}
Пример #24
0
void _vfprintf(void (* f)(int), const char *fmt, va_list va)
{
	const char *p;
	char c, w;
	int val;

	while ((c = *fmt++) != '\0') {
		if (c != '%') {
			f(c);
		} else {
			c = *fmt++;

			w = 0;
			if (c == '0') {
				c = *fmt++;
				if (c >= '0' && c <= '8') {
					w = c - '0';
					c = *fmt++;
				}
			}

			switch (c) {
				case 'd':
					val = va_arg(va, int);
					if (val < 0) {
						f('-');
						val = -val;
					}
					_itoa((unsigned)val, f, 10, w);
					break;
				case 'X' : 
					_itoa((unsigned)va_arg(va, int), f, 16, w);
					break;
				case 's' :
					p = va_arg(va, const char *);
					while (*p != '\0')
						f(*p++);
					break;
			}
		}
	}
}
Пример #25
0
bool Twindow::TwidgetSubclassTbr::onEdit(void)
{
    int idff=self->getTbrIdff(id,bind);
    TffdshowParamInfo info;
    memset(&info,0,sizeof(info));
    if (self->deci->getParamInfo(idff,&info)!=S_OK) {
        return false;
    }
    int min,max,val;
    getEditMinMaxVal(info,&min,&max,&val);
    char_t valS[20];
    _itoa(val,valS,10);
    char_t query[100];
    tsprintf(query,self->_(0,_l("Enter value in range from %i to %i")),min,max);
    if (!self->inputString(self->_(0,_l("Edit trackbar value")),query,valS,20)) {
        return false;
    }
    storeEditValue(info,min,max,valS);
    return true;
}
Пример #26
0
// *************************************************************************************************
// @fn          display_eggtimer
// @brief       eggtimer user routine.
// @param       u8 line		LINE2
//		u8 update	DISPLAY_LINE_UPDATE_PARTIAL, DISPLAY_LINE_UPDATE_FULL
// @return      none
// *************************************************************************************************
void display_eggtimer(u8 line, u8 update)
{
	u8 * str;
	
	// Partial line update only
	if (update == DISPLAY_LINE_UPDATE_PARTIAL)
	{
		// Check draw flag to minimize workload
		switch(sEggtimer.drawFlag) 
		{
		    case 3: // Hours changed
			str = _itoa(sEggtimer.hours, 2, 0);
			display_chars(LCD_SEG_L2_5_4, str, SEG_ON);
		    case 2: // Minutes changed
			str = _itoa(sEggtimer.minutes, 2, 0);
			display_chars(LCD_SEG_L2_3_2, str, SEG_ON);
		    case 1: // Seconds changed
			str = _itoa(sEggtimer.seconds, 2, 0);
			display_chars(LCD_SEG_L2_1_0, str, SEG_ON);
		}
		sEggtimer.drawFlag = 0; // Clear draw flag
	}
	// Redraw whole line
	else if (update == DISPLAY_LINE_UPDATE_FULL)	
	{
		// Display HH:MM:SS		
		str = _itoa(sEggtimer.hours, 2, 0);
		display_chars(LCD_SEG_L2_5_4, str, SEG_ON);
		str = _itoa(sEggtimer.minutes, 2, 0);
		display_chars(LCD_SEG_L2_3_2, str, SEG_ON);
		str = _itoa(sEggtimer.seconds, 2, 0);
		display_chars(LCD_SEG_L2_1_0, str, SEG_ON);
		
		display_symbol(LCD_SEG_L2_COL1, SEG_ON);
		display_symbol(LCD_SEG_L2_COL0, SEG_ON);
		
		if (sEggtimer.state != EGGTIMER_STOP) { // Blink if running or alarm triggered
			display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_ON);
		}
		else { // Solid on if not running
			display_symbol(LCD_ICON_RECORD, SEG_ON_BLINK_OFF);
		}
	}
	else if (update == DISPLAY_LINE_CLEAR)
	{
		// Stop blinking icon only if eggtimer isn't running
		if (sEggtimer.state == EGGTIMER_STOP) display_symbol(LCD_ICON_RECORD, SEG_OFF);
	}
}
Пример #27
0
BOOL KCameraOptionDialog::OnInitDialog()
{
	char szText[128];
	if (!m_pPlayer)
		return FALSE;
	if (m_pPlayer->IsFreeCamera())
		m_nFreeCamera = 1;
	else 
		m_nFreeCamera = 0;

	m_nCameraType = s_CameraTypeConvertTable[m_pPlayer->GetCameraType()];
	UpdateData(FALSE);

	_itoa(m_pPlayer->GetBindID(), szText, 10);
	m_editBindID.SetWindowTextA(szText);
	float fAAA = (m_pPlayer->GetAngle() * 180) / M_PI;
	gcvt(fAAA,5,szText);
	m_editAngle.SetWindowTextA(szText);	
	return TRUE;
}
Пример #28
0
void AssertFSz(BOOLFLAG fAssertion, int nline, char* szFile, char* szMsg)
{
    if (!fAssertion)
    {
        char szAssertBuf[MAXASSERTBUF];
        char szTempBuf[MAXTEMPBUF];

        _itoa(nline,szTempBuf,10);
        strcpy(szAssertBuf,"Assertion Failure in line ");
        szTempBuf[MAXTEMPBUF - 1]= '\0';
        strcat(szAssertBuf,szTempBuf);
        strcat(szAssertBuf," of file ");
        szFile[_MAX_PATH -1] = '\0';
        strcat(szAssertBuf,szFile);

        if (szMsg)
        {
            szMsg[MAXASSERTBUF / 2] = '\0';
            strcat(szAssertBuf,"\n");
            strcat(szAssertBuf,szMsg);
        }

        strcat(szAssertBuf,"\n");
#if !defined(_CONSOLE)
        strcat(szAssertBuf,"Press OK to continue, Cancel to Debug");
        if (MessageBox(
                NULL,
                szAssertBuf,
                "Assertion Failure",
                MB_APPLMODAL | MB_ICONSTOP | MB_OKCANCEL) == IDCANCEL)
        {
            DebugBreak();
        }
#else /* !defined(_CONSOLE) */
        printf("%s\n",szAssertBuf);

        DebugBreak();

#endif /* defined(_CONSOLE) */
    }
}
Пример #29
0
bool BinOArchive::operator()(ContainerInterface& ser, const char* name, const char* label)
{
	openNode(name, false);

	unsigned int size = (unsigned int)ser.size();
	if(size < SIZE16)
		stream_.write((unsigned char)size);
	else if(size < 0x10000){
		stream_.write(SIZE16);
		stream_.write((unsigned short)size);
	}
	else{
		stream_.write(SIZE32);
		stream_.write(size);
	}

	if(strlen(name)){
		if(size > 0){
			int i = 0;
			do {
				char buffer[16];
#ifdef _MSC_VER
				_itoa(i++, buffer, 10);
#else
				sprintf(buffer, "%d", i++);
#endif
				ser(*this, buffer, "");
			} while (ser.next());
		}

		closeNode(name, false);
	}
	else{
		if(size > 0)
			do 
				ser(*this, "", "");
				while (ser.next());
	}

    return true;
}
Пример #30
0
/*:::::*/
FBCALL FBSTRING *fb_IntToStr ( int num )
{
    FBSTRING 	*dst;

    /* alloc temp string */
    dst = fb_hStrAllocTemp( NULL, sizeof( int ) * 3 );
    if( dst != NULL )
    {
        /* convert */
#ifdef HOST_MINGW
        _itoa( num, dst->data, 10 );
#else
        sprintf( dst->data, "%d", num );
#endif
        fb_hStrSetLength( dst, strlen( dst->data ) );
    }
    else
        dst = &__fb_ctx.null_desc;

    return dst;
}