• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ di函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: di

void SE_StructItem::setDataItem(const SE_Vector4f& v, int index)
{
    SE_DataItem di(SE_DataItem::VECTOR4F_ITEM);
    di.data.vec4f = new SE_Vector4f(v);
    SET_DATA_ITEM(di, index);
}
开发者ID:26597925,项目名称:3DHome,代码行数:6,代码来源:SE_Struct.cpp


示例2: generate_test_spans_10x10000

void UnitTestSTKParallelDistributedIndex::test_update_generate()
{
  typedef stk::parallel::DistributedIndex PDIndex ;

  stk::ParallelMachine comm = MPI_COMM_WORLD ;

  int p_rank = stk::parallel_machine_rank(comm);
  int p_size = stk::parallel_machine_size(comm);

  std::vector< PDIndex::KeySpan > partition_spans ;

  generate_test_spans_10x10000( partition_spans );

  PDIndex di( comm , partition_spans );

  std::vector<size_t> requests( partition_spans.size() , size_t(0) );
  std::vector< std::vector<PDIndex::KeyType> > generated_keys ;
  std::vector<PDIndex::KeyProc> sharing_of_local_keys ;

  std::vector<PDIndex::KeyType> keys_to_add ;
  std::vector<PDIndex::KeyType> keys_to_remove ;

  //------------------------------
  // Add ( 5 * j ) odd keys per process
  // starting at the beginning of the partition.

  const size_t old_size_multiplier = 5 ;

  for ( size_t j = 0 ; j < partition_spans.size() ; ++j ) {
    PDIndex::KeyType key_first = partition_spans[j].first ;
    if ( 0 == key_first % 2 ) { ++key_first ; } // Make it odd
    key_first += old_size_multiplier * p_rank ;

    const size_t n = old_size_multiplier * j ;
    for ( size_t i = 0 ; i < n ; ++i ) {
      PDIndex::KeyType key = key_first + 2 * i ;
      keys_to_add.push_back( key );
    }
  }

  di.update_keys( keys_to_add , keys_to_remove );

  //------------------------------
  // Request 20 new keys per process per span
  // The maximum new key will be larger than some spans
  // and within the gaps of other spans.

  const size_t gen_count = 20 ;
  for ( size_t i = 0 ; i < requests.size() ; ++i ) {
    if ( i % 2 ) {
      requests[i] = gen_count ;
    }
    else {
      requests[i] = 0 ;
    }
  }

  di.generate_new_keys( requests , generated_keys );

  for ( size_t i = 0 ; i < requests.size() ; ++i ) {
    EXPECT_EQ( requests[i] , generated_keys[i].size() );

    const size_t old_count   = p_size * old_size_multiplier * i ;
    const size_t tot_request = p_size * requests[i] ;

    PDIndex::KeyType max_gen_key = partition_spans[i].first ;

    if ( 0 == tot_request ) {
      EXPECT_TRUE( generated_keys[i].size() == 0 );
    }
    else if ( tot_request < old_count ) {
      // Will only fill in gaps between odd keys
      max_gen_key += 2 * old_count ;

      EXPECT_TRUE( max_gen_key > generated_keys[i][ requests[i] - 1 ] );
    }
    else {
      // Will fill in gaps contiguously after the old max key
      max_gen_key += old_count + tot_request - 1 ;

      EXPECT_TRUE( max_gen_key >= generated_keys[i][ requests[i] - 1 ] );
    }

    // Sorted
    for ( size_t j = 0 ; j < generated_keys[i].size() ; ++j ) {
      if ( 0 < j ) {
        EXPECT_TRUE( generated_keys[i][j-1] < generated_keys[i][j] );
      }
    }
  }
}
开发者ID:haripandey,项目名称:trilinos,代码行数:91,代码来源:UnitTestDistributedIndex.cpp


示例3: doexit

void doexit(int16_t val, int16_t val2)
{
	int16_t j;
	ptptr p;
	irqflags_t irq;

#ifdef DEBUG
	kprintf("process %d exiting\n", udata.u_ptab->p_pid);

	kprintf
	    ("udata.u_page %u, udata.u_ptab %x, udata.u_ptab->p_page %u\n",
	     udata.u_page, udata.u_ptab, udata.u_ptab->p_page);
#endif
	if (udata.u_ptab->p_pid == 1)
		panic("killed init");

	_sync();		/* Not necessary, but a good idea. */

	irq = di();

	/* Discard our memory before we blow away and reuse the memory */
	pagemap_free(udata.u_ptab);

	for (j = 0; j < UFTSIZE; ++j) {
		if (udata.u_files[j] != NO_FILE)
			doclose(j);
	}


	udata.u_ptab->p_exitval = (val << 8) | (val2 & 0xff);

	i_deref(udata.u_cwd);
	i_deref(udata.u_root);

	/* Stash away child's execution tick counts in process table,
	 * overlaying some no longer necessary stuff.
	 *
	 * Pedantically POSIX says we should do this at the point of wait()
	 */
	udata.u_utime += udata.u_cutime;
	udata.u_stime += udata.u_cstime;
	memcpy(&(udata.u_ptab->p_priority), &udata.u_utime,
	       2 * sizeof(clock_t));

	for (p = ptab; p < ptab_end; ++p) {
		if (p->p_status == P_EMPTY || p == udata.u_ptab)
			continue;
		/* Set any child's parents to our parent */
		if (p->p_pptr == udata.u_ptab)
			p->p_pptr = udata.u_ptab->p_pptr;
		/* Send SIGHUP to any pgrp members and remove
		   them from our pgrp */
                if (p->p_pgrp == udata.u_ptab->p_pid) {
			p->p_pgrp = 0;
			ssig(p, SIGHUP);
		}
	}
	tty_exit();
	irqrestore(irq);
#ifdef DEBUG
	kprintf
	    ("udata.u_page %u, udata.u_ptab %x, udata.u_ptab->p_page %u\n",
	     udata.u_page, udata.u_ptab, udata.u_ptab->p_page);
#endif
#ifdef CONFIG_ACCT
	acctexit(p);
#endif
        udata.u_page = 0xFFFFU;
        udata.u_page2 = 0xFFFFU;
	/* FIXME: send SIGCLD here */
	/* FIXME: POSIX.1 says that SIG_IGN for SIGCLD means don't go
	   zombie, just clean up as we go */
	/* Wake up a waiting parent, if any. */
	wakeup((char *) udata.u_ptab->p_pptr);

	udata.u_ptab->p_status = P_ZOMBIE;
	nready--;
	nproc--;

	switchin(getproc());
	panic("doexit: won't exit");
}
开发者ID:NoSuchProcess,项目名称:FUZIX,代码行数:82,代码来源:process.c


示例4: HHVM_STATIC_METHOD

Object HHVM_STATIC_METHOD(DateInterval, createFromDateString,
                          const String& time) {
  SmartResource<DateInterval> di(newres<DateInterval>(time, true));
  return DateIntervalData::wrap(di);
}
开发者ID:Seldaek,项目名称:hhvm,代码行数:5,代码来源:ext_datetime.cpp


示例5: MainDlgProc


//.........这里部分代码省略.........
               }
               break;
            };
            return TRUE;

            case IDC_REFME_LIST:
            case IDC_IREF_LIST:
               if (HIWORD(wParam) == LBN_DBLCLK)
               {
                  TSTR str;
                  HWND hIRefList = GetDlgItem(hWnd, IDC_IREF_LIST);
                  HWND hRefMeList = GetDlgItem(hWnd, IDC_REFME_LIST);
                  BOOL ok = TRUE;

                  // Get list item.
                  HWND listbox = (HWND)lParam;
                  int i = SendMessage(listbox, LB_GETCURSEL, 0, 0);

                  // Change the currently watched object.
                  if (LOWORD(wParam) == IDC_IREF_LIST)
                     rc->watchMe = rc->watchMe->GetReference(i);
                  else
                  {
                     bool fulltree = IsDlgButtonChecked(hWnd, IDC_FULLTREE) ? true : false;
                     if (fulltree)
                     {
                        // Enum dependents.
                        RefCheckFindDepEnumProc rfep(i, rc->watchMe);
                        rc->watchMe->DoEnumDependents(&rfep);
                        if (rfep.rmaker != NULL)
                        {
                           if (!OkToDisplay(hWnd, rfep.rmaker))
                              return TRUE;
                           rc->watchMe = (ReferenceTarget*)rfep.rmaker;
                        }
                        else
                           ok = FALSE;
                     }
                     else
                     {
                        // We only displayed first-level dependents.
                        int count = 0;
                        DependentIterator di(rc->watchMe);
                        ReferenceMaker* maker = NULL;
                        while ((maker = di.Next()) != NULL)
                        {
                           if (count == i)
                           {
                              if (!OkToDisplay(hWnd, maker))
                                 return TRUE;
                              rc->watchMe = (ReferenceTarget*)maker;
                              break;
                           }
                           if (count > i) return TRUE;// not sure how this could happen...
                           ++count;
                        }
                     }
                  }

                  SetWindowText(GetDlgItem(hWnd, IDC_CLASSNAME), _T(""));
                  SetWindowText(GetDlgItem(hWnd, IDC_CLIENTNAME), _T(""));
                  if (ok) {
                     buf.printf(_T("Item Name: %s"), rc->GetName());
                     SetWindowText(GetDlgItem(hWnd, IDC_ITEM_NAME), buf.data());
                     notifyObject.RemoveReference();
                     notifyObject.CreateReference(rc->watchMe);
                     rc->watchMe->GetClassName(str);
                     buf.printf(_T("This Target ClassName: %s"), str);
                     SetWindowText(GetDlgItem(hWnd, IDC_CLASSNAME), buf.data());

                     buf.printf(_T("Client ClassName: %s"), _T("(Unable to determine)"));
                     SetWindowText(GetDlgItem(hWnd, IDC_CLIENTNAME), buf.data());
                     Tab<TSTR *> ptStr;
                     TSTR *pTstr, Str(_T(""));
                     pTstr = &Str;
                     ptStr.Append(1, &pTstr);
                     DisplayRefInfo(rc, hWnd, &ptStr);
                     SendMessage(GetDlgItem(hWnd, IDC_MSG_LIST), LB_RESETCONTENT, 0, 0L);
                  }
                  else {
                     rc->watchMe = NULL;
                     notifyObject.RemoveReference();
                     SendMessage(hIRefList, LB_RESETCONTENT, 0, 0L);
                     SendMessage(hRefMeList, LB_RESETCONTENT, 0, 0L);
                     SendMessage(GetDlgItem(hWnd, IDC_MSG_LIST), LB_RESETCONTENT, 0, 0L);
                     SetWindowText(GetDlgItem(hWnd, IDC_CLASSNAME), _T(""));
                     SetWindowText(GetDlgItem(hWnd, IDC_CLIENTNAME), _T(""));
                     SetWindowText(GetDlgItem(hWnd, IDC_ITEM_NAME), _T(""));
                  }
               }
               break;

         };
         break;

      default:
         return FALSE;
   };
   return TRUE;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:101,代码来源:refcheck.cpp


示例6: IsWhiteSpace

//
// Check the given name to see if it is a valid macro name.
// If realMacro is TRUE, then don't allow the name to be 'main'.
// If it is return TRUE, othewise return FALSE and issue an error
// message.
//
boolean SetMacroNameDialog::verifyMacroName(const char *name, boolean realMacro)
{
    int i = 0;
    if (realMacro && IsToken(name,"main",i) &&
               (!name[i] || IsWhiteSpace(name,i))) 
    {
	ModalErrorMessage(this->getRootWidget(),
		"Macro name cannot be \"main\".");
	return FALSE;
    }
    i = 0;
    if (!IsRestrictedIdentifier(name, i) )
    {
	ModalErrorMessage(this->getRootWidget(),
		"Macro name `%s' must start with a letter and consist "
		     "of only letters and numbers", name);
	return FALSE;
    }
    SkipWhiteSpace(name, i);
    if (name[i] != '\0')
    {
	ModalErrorMessage(this->getRootWidget(),
		"Macro name `%s' must start with a letter and consist "
		     "of only letters and numbers", name);
	return FALSE;
    }

    if (IsReservedScriptingWord(name)) {
        ErrorMessage("Macro name \"%s\" is a reserved word", name);
        return FALSE;
    }


    NodeDefinition *nd;
    DictionaryIterator di(*theNodeDefinitionDictionary);
    Symbol nameSym = theSymbolManager->registerSymbol(name);
    while ( (nd = (NodeDefinition*)di.getNextDefinition()) )
    {
	if (nd->getNameSymbol() == nameSym)
	{ 
            if (!nd->isDerivedFromMacro())
            {
                ModalErrorMessage(this->getRootWidget(),
                    "Macro name `%s' is the name of a Data Explorer module.\n"
                    "Macro names must not be the same as a module name.",
                         name);
                return FALSE;
            } 
	    else if (this->network->getDefinition() != 
				(MacroDefinition*)nd) // && is Macro 
	    {
                ModalErrorMessage(this->getRootWidget(),
                    "Macro name `%s' is the name of an already loaded macro.",
                         name);
                return FALSE;
            }
	}
    }

    return TRUE;
}
开发者ID:BackupTheBerlios,项目名称:opendx2,代码行数:67,代码来源:SetMacroNameDialog.C


示例7: Config_getBool

void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit)
{
  static bool clangAssistedParsing = Config_getBool("CLANG_ASSISTED_PARSING");
  static QStrList &includePath = Config_getList("INCLUDE_PATH");
  static QStrList clangOptions = Config_getList("CLANG_OPTIONS");
  if (!clangAssistedParsing) return;
  //printf("ClangParser::start(%s)\n",fileName);
  p->fileName = fileName;
  p->index    = clang_createIndex(0, 0);
  p->curLine  = 1;
  p->curToken = 0;
  char **argv = (char**)malloc(sizeof(char*)*(4+Doxygen::inputPaths.count()+includePath.count()+clangOptions.count()));
  QDictIterator<void> di(Doxygen::inputPaths);
  int argc=0;
  // add include paths for input files
  for (di.toFirst();di.current();++di,++argc)
  {
    QCString inc = QCString("-I")+di.currentKey();
    argv[argc]=strdup(inc.data());
    //printf("argv[%d]=%s\n",argc,argv[argc]);
  }
  // add external include paths
  for (uint i=0;i<includePath.count();i++)
  {
    QCString inc = QCString("-I")+includePath.at(i);
    argv[argc++]=strdup(inc.data());
  }
  // user specified options
  for (uint i=0;i<clangOptions.count();i++)
  {
    argv[argc++]=strdup(clangOptions.at(i));
  }
  // extra options
  argv[argc++]=strdup("-ferror-limit=0");
  argv[argc++]=strdup("-x");

  // Since we can be presented with a .h file that can contain C/C++ or
  // Objective C code and we need to configure the parser before knowing this,
  // we use the source file to detected the language. Detection will fail if you
  // pass a bunch of .h files containing ObjC code, and no sources :-(
  SrcLangExt lang = getLanguageFromFileName(fileName);
  if (lang==SrcLangExt_ObjC || p->detectedLang!=ClangParser::Private::Detected_Cpp)
  {
    QCString fn = fileName;
    if (p->detectedLang==ClangParser::Private::Detected_Cpp && 
        (fn.right(4).lower()==".cpp" || fn.right(4).lower()==".cxx" ||
         fn.right(3).lower()==".cc" || fn.right(2).lower()==".c"))
    { // fall back to C/C++ once we see an extension that indicates this
      p->detectedLang = ClangParser::Private::Detected_Cpp;
    }
    else if (fn.right(3).lower()==".mm") // switch to Objective C++
    {
      p->detectedLang = ClangParser::Private::Detected_ObjCpp;
    }
    else if (fn.right(2).lower()==".m") // switch to Objective C
    {
      p->detectedLang = ClangParser::Private::Detected_ObjC;
    }
  }
  switch(p->detectedLang)
  {
    case ClangParser::Private::Detected_Cpp: 
      argv[argc++]=strdup("c++"); 
      break;
    case ClangParser::Private::Detected_ObjC: 
      argv[argc++]=strdup("objective-c"); 
      break;
    case ClangParser::Private::Detected_ObjCpp: 
      argv[argc++]=strdup("objective-c++"); 
      break;
  }

  // provide the input and and its dependencies as unsaved files so we can
  // pass the filtered versions
  argv[argc++]=strdup(fileName);
  static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES");
  //printf("source %s ----------\n%s\n-------------\n\n",
  //    fileName,p->source.data());
  uint numUnsavedFiles = filesInTranslationUnit.count()+1;
  p->numFiles = numUnsavedFiles;
  p->sources = new QCString[numUnsavedFiles];
  p->ufs     = new CXUnsavedFile[numUnsavedFiles];
  p->sources[0]      = detab(fileToString(fileName,filterSourceFiles,TRUE));
  p->ufs[0].Filename = strdup(fileName);
  p->ufs[0].Contents = p->sources[0].data();
  p->ufs[0].Length   = p->sources[0].length();
  QStrListIterator it(filesInTranslationUnit);
  uint i=1;
  for (it.toFirst();it.current() && i<numUnsavedFiles;++it,i++)
  {
    p->fileMapping.insert(it.current(),new uint(i));
    p->sources[i]      = detab(fileToString(it.current(),filterSourceFiles,TRUE));
    p->ufs[i].Filename = strdup(it.current());
    p->ufs[i].Contents = p->sources[i].data();
    p->ufs[i].Length   = p->sources[i].length();
  }

  // let libclang do the actual parsing
  p->tu = clang_parseTranslationUnit(p->index, 0,
                                     argv, argc, p->ufs, numUnsavedFiles, 
//.........这里部分代码省略.........
开发者ID:Acidburn0zzz,项目名称:doxygen,代码行数:101,代码来源:clangparser.cpp


示例8: GetDeviceState

/* This doesn't take a timestamp; instead, we let InputHandler::ButtonPressed figure
 * it out.  Be sure to call InputHandler::Update() between each poll. */
void InputHandler_DInput::UpdatePolled(DIDevice &device, const RageTimer &tm)
{
	if( device.type == device.KEYBOARD )
	{
		unsigned char keys[256];

		HRESULT hr = GetDeviceState(device.Device, 256, keys);
		if ( hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED )
			return;

		if ( hr != DI_OK )
		{
			LOG->MapLog( "UpdatePolled", hr_ssprintf(hr, "Failures on polled keyboard update") );
			return;
		}

		for( int k = 0; k < 256; ++k )
		{
			const int key = device.Inputs[k].num;
			ButtonPressed(DeviceInput(device.dev, key), !!(keys[k] & 0x80));
		}
		return;
	}

	DIJOYSTATE state;

	HRESULT hr = GetDeviceState(device.Device, sizeof(state), &state);
	if ( hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED )
		return;

	/* Set each known axis, button and POV. */
	for(unsigned i = 0; i < device.Inputs.size(); ++i)
	{
		const input_t &in = device.Inputs[i];
		const InputDevice dev = device.dev;

		switch(in.type)
		{
		case in.BUTTON:
		{
			DeviceInput di(dev, JOY_1 + in.num, -1, tm);
			ButtonPressed(di, !!state.rgbButtons[in.ofs - DIJOFS_BUTTON0]);
			break;
		}

		case in.AXIS:
		{
			JoystickButton neg = NUM_JOYSTICK_BUTTONS, pos = NUM_JOYSTICK_BUTTONS;
			int val = 0;
			switch(in.ofs)
			{
			case DIJOFS_X:  neg = JOY_LEFT; pos = JOY_RIGHT;
							val = state.lX;
							break;
			case DIJOFS_Y:  neg = JOY_UP; pos = JOY_DOWN;
							val = state.lY;
							break;
			case DIJOFS_Z:  neg = JOY_Z_UP; pos = JOY_Z_DOWN;
							val = state.lZ;
							break;
			case DIJOFS_RX: neg = JOY_ROT_LEFT; pos = JOY_ROT_RIGHT;
							val = state.lRx;
							break;
			case DIJOFS_RY: neg = JOY_ROT_UP; pos = JOY_ROT_DOWN;
							val = state.lRy;
							break;
			case DIJOFS_RZ: neg = JOY_ROT_Z_UP; pos = JOY_ROT_Z_DOWN;
							val = state.lRz;
							break;
			case DIJOFS_SLIDER(0):
							neg = JOY_AUX_1; pos = JOY_AUX_2;
							val = state.rglSlider[0];
							break;
			case DIJOFS_SLIDER(1):
							neg = JOY_AUX_3; pos = JOY_AUX_4;
							val = state.rglSlider[1];
							break;
			default: LOG->MapLog("unknown input", 
							"Controller '%s' is returning an unknown joystick offset, %i",
							device.JoystickInst.tszProductName, in.ofs );
					 continue;
			}
			if( neg != NUM_JOYSTICK_BUTTONS )
			{
				float l = SCALE( int(val), 0.0f, 100.0f, 0.0f, 1.0f );
				ButtonPressed(DeviceInput(dev, neg, max(-l,0), tm), val < -50);
				ButtonPressed(DeviceInput(dev, pos, max(+l,0), tm), val > 50);
			}

			break;
		}

		case in.HAT:
			if( in.num == 0 )
			{
				const int pos = TranslatePOV(state.rgdwPOV[in.ofs - DIJOFS_POV(0)]);
				ButtonPressed(DeviceInput(dev, JOY_HAT_UP, -1, tm), !!(pos & HAT_UP_MASK));
				ButtonPressed(DeviceInput(dev, JOY_HAT_DOWN, -1, tm), !!(pos & HAT_DOWN_MASK));
//.........这里部分代码省略.........
开发者ID:BitMax,项目名称:openitg,代码行数:101,代码来源:InputHandler_DirectInput.cpp


示例9: main


//.........这里部分代码省略.........
                }
            }
        }
        RS_DEBUG->print("param 0: %s", argv[0]);

        QFileInfo prgInfo( QFile::decodeName(argv[0]) );
        QString prgDir(prgInfo.absolutePath());
    RS_SETTINGS->init(XSTR(QC_COMPANYKEY), XSTR(QC_APPKEY));
    RS_SYSTEM->init(XSTR(QC_APPNAME), XSTR(QC_VERSION), XSTR(QC_APPDIR), prgDir);

        RS_FileIO::instance()->registerFilter(&( RS_FilterLFF::createFilter));
        RS_FileIO::instance()->registerFilter( &(RS_FilterDXFRW::createFilter));
        RS_FileIO::instance()->registerFilter( &(RS_FilterCXF::createFilter));
        RS_FileIO::instance()->registerFilter( &(RS_FilterJWW::createFilter));
        RS_FileIO::instance()->registerFilter( &(RS_FilterDXF1::createFilter));

        // parse command line arguments that might not need a launched program:
        QStringList fileList = handleArgs(argc, argv);

        QString lang;
        QString langCmd;
        QString unit;

        RS_SETTINGS->beginGroup("/Defaults");
#ifndef QC_PREDEFINED_UNIT
        unit = RS_SETTINGS->readEntry("/Unit", "Invalid");
#else
        unit = RS_SETTINGS->readEntry("/Unit", QC_PREDEFINED_UNIT);
#endif
    RS_SETTINGS->endGroup();

        // show initial config dialog:
        if (unit=="Invalid") {
                RS_DEBUG->print("main: show initial config dialog..");
                QG_DlgInitial di(NULL);
                di.setText("<font size=\"+1\"><b>Welcome to " XSTR(QC_APPNAME) "</b></font>"
                "<br>"
                "Please choose the unit you want to use for new drawings and your "
                "preferred language.<br>"
                "You can changes these settings later in the "
                "Options Dialog of " XSTR(QC_APPNAME) ".");
                QPixmap pxm(":/main/intro_librecad.png");
                di.setPixmap(pxm);
                if (di.exec()) {
                        RS_SETTINGS->beginGroup("/Defaults");
                        unit = RS_SETTINGS->readEntry("/Unit", "None");
                RS_SETTINGS->endGroup();
                }
                RS_DEBUG->print("main: show initial config dialog: OK");
        }

#ifdef QSPLASHSCREEN_H
        RS_DEBUG->print("main: splashscreen..");

        QPixmap* pixmap = new QPixmap(":/main/splash_librecad.png");
# endif

        RS_DEBUG->print("main: init fontlist..");
    RS_FONTLIST->init();
        RS_DEBUG->print("main: init fontlist: OK");

        RS_DEBUG->print("main: init patternlist..");
    RS_PATTERNLIST->init();
        RS_DEBUG->print("main: init patternlist: OK");

        RS_DEBUG->print("main: init scriptlist..");
开发者ID:NHellFire,项目名称:LibreCAD,代码行数:67,代码来源:main.cpp


示例10: di

Object c_DateInterval::ti_createfromdatestring(CStrRef time) {
  SmartObject<DateInterval> di(NEWOBJ(DateInterval)(time, true));
  return c_DateInterval::wrap(di);
}
开发者ID:Parent5446,项目名称:hiphop-php,代码行数:4,代码来源:ext_datetime.cpp


示例11: Install

void Install(bool& rebootReqd)
{
    // retrieve the full path for our .inf
    std::wstring infPath;
    {
        auto pathLength = ::GetFullPathNameW(WINDTUNNEL_INF_NAME, 0, nullptr, nullptr);
        if (!pathLength)
        {
            throw nt::Win32Exception(::GetLastError(), L"Failed to find " WINDTUNNEL_INF_NAME, __FILE__, __LINE__);
        }

        auto buffer = std::unique_ptr<wchar_t[]>(new wchar_t[pathLength]);
        ::GetFullPathNameW(WINDTUNNEL_INF_NAME, pathLength, buffer.get(), nullptr);
        infPath = buffer.get();

        _TRACE_T(L"INF file path: [%s]", infPath.c_str());
    }

    // retrieve class GUID
    GUID classGUID;
    wchar_t className[MAX_CLASS_NAME_LEN];
    if (!::SetupDiGetINFClassW(infPath.c_str(), &classGUID, className, _countof(className), nullptr))
    {
        throw nt::Win32Exception(::GetLastError(), L"Failed to retrieve class GUID from " WINDTUNNEL_INF_NAME, __FILE__, __LINE__);
    }

    _TRACE_T(L"Class GUID: {%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", 
        classGUID.Data1, classGUID.Data2, classGUID.Data3, classGUID.Data4[0], classGUID.Data4[1], classGUID.Data4[2], classGUID.Data4[3], classGUID.Data4[4], classGUID.Data4[5], classGUID.Data4[6], classGUID.Data4[7]);

    _TRACE_T(L"Class name: %s", className);

    nt::setup::DeviceInformationSet di(classGUID);
    auto deviceInfo = di.createDeviceInfo(className, classGUID, nullptr, DICD_GENERATE_ID);

    wchar_t hardwareIdList[LINE_LEN + 4] = { 0 };
    ::StringCchCopyW(hardwareIdList, LINE_LEN, WINDTUNNEL_HWID);

    di.setDeviceRegistryProperty(
        deviceInfo,
        SPDRP_HARDWAREID,
        hardwareIdList,
        (::lstrlenW(hardwareIdList) + 2) * sizeof(wchar_t) // HW ID list must be terminated with \0\0
        );

    di.callClassInstaller(DIF_REGISTERDEVICE, deviceInfo);

    BOOL rebootRequired = FALSE;
    if (!::UpdateDriverForPlugAndPlayDevicesW(0, WINDTUNNEL_HWID, infPath.c_str(), INSTALLFLAG_FORCE, &rebootRequired))
    {
        throw nt::Win32Exception(::GetLastError(), L"Failed to install " WINDTUNNEL_HWID, __FILE__, __LINE__);
    }

    RenameAudioEndpoints();

    if (rebootRequired)
    {
        _TRACE_T("Reboot is required");
    }

    rebootReqd = !!rebootRequired;
}
开发者ID:LeeOswald,项目名称:WindTunnel,代码行数:61,代码来源:install.cpp


示例12: keyscan

void keyscan()
{
   static int flag=0,flag_ymd=0;
   if(s1==0)  //功能键s1  
   {
       delay(10);
	 if(s1==0)
	 {
	        while(!s1);	
	        flag++;
			di();
	   	    if(flag==1)
	    	{
		 		flag_ds=1;
		 		write_com(0x80+0x40+10);
		 		write_com(0x0f);
				diii();
			}
	    	if(flag==2)
	    	{
	      		 write_com(0x80+0x40+7);
		   	}
	   		if(flag==3)
	    	{
	      		 write_com(0x80+0x40+4);
	    	}
			if(flag==4)//week
			{			 			    
				write_com(0x80+12);
				flag_ymd=1;
			}
			if(flag==5)	//day
			{			 			    
				write_com(0x80+9);
				flag_ymd=2;
			}
			if(flag==6)	//moth
			{			 			    
				write_com(0x80+6);
				flag_ymd=3;
			}
			if(flag==7)	 //year
			{			 			    
				write_com(0x80+3);
				flag_ymd=4;
			}
	    	if(flag==8)
	    	{
		   		diii();
		  		flag=0;
		  		flag_ds=0;
				flag_ymd=0;
				write_com(0x0c);
		  		write_ds(0,miao);
		  		write_ds(2,fen);
		  		write_ds(4,shi);
				write_ds(6,week);
				write_ds(7,day);
				write_ds(8,moth);
				write_ds(9,year);
			}
	 } 
   }
   if(flag!=0)
   {
       if(s2==0)	 //加数键s2	   加数键s2		加数键s2	 加数键s2
	 {
	     delay(5);
	     if(s2==0)
	     {
	        while(!s2);
			 di();
		   if(flag_ymd==0)
		   {
		   /*****************************/
		   if(flag==1)
		   {
		        miao++;
			  if(miao==60)
			  {
			       miao=0;
			  }
			  write_time(10,miao,2);
			  write_com(0x80+0x40+10);
		   }
		   if(flag==2)
		   {
		        fen++;
			  if(fen==60)
			  {
			       fen=0;
			  }
			  write_time(7,fen,2);
			  write_com(0x80+0x40+7);
		   }
		   if(flag==3)
		   {
		        shi++;
			  if(shi==24)
			  {
//.........这里部分代码省略.........
开发者ID:liruixin,项目名称:DS12C887,代码行数:101,代码来源:key.c


示例13: Uninstall

void Uninstall(bool& rebootReqd)
{
    nt::setup::DeviceInformationSet di(DIGCF_PRESENT | DIGCF_ALLCLASSES);
    auto data = di.detailData();

    auto deviceInfo = di.enumDeviceInfo();
    for (const auto& devInfo : deviceInfo)
    {
        wchar_t devID[MAX_DEVICE_ID_LEN] = { 0 };
        
        // determine instance ID
        ::CM_Get_Device_ID_ExW(devInfo.DevInst, devID, MAX_DEVICE_ID_LEN, 0, data.RemoteMachineHandle);

        bool match = false;

        std::vector<std::wstring> vHwIds;
        try
        {
            auto propHwIds = di.deviceRegistryProperty(devInfo, SPDRP_HARDWAREID);
            _ASSERT(propHwIds.first == REG_MULTI_SZ);
            ExpandMultiSz(propHwIds.second.get(), vHwIds);
        }
        catch (std::exception&)
        {
        }

        for (const auto& s : vHwIds)
        {
            if (!::_wcsicmp(s.c_str(), WINDTUNNEL_HWID))
            {
                match = true;
                break;
            }
        }

        if (!match)
        {
            std::vector<std::wstring> vCompatibleIds;
            try
            {
                auto propCompatibleIds = di.deviceRegistryProperty(devInfo, SPDRP_COMPATIBLEIDS);
                _ASSERT(propCompatibleIds.first == REG_MULTI_SZ);
                ExpandMultiSz(propCompatibleIds.second.get(), vCompatibleIds);
            }
            catch (std::exception&)
            {
            }

            for (const auto& s : vCompatibleIds)
            {
                if (!::_wcsicmp(s.c_str(), WINDTUNNEL_HWID))
                {
                    match = true;
                    break;
                }
            }
        }

        if (match)
        {
            return UninstallDevice(di, devInfo, rebootReqd);
        }
    }

    throw nt::Exception(L"Could not find hardware ID " WINDTUNNEL_HWID, __FILE__, __LINE__);
}
开发者ID:LeeOswald,项目名称:WindTunnel,代码行数:66,代码来源:install.cpp


示例14: main

/**
 * Main. Creates Application window.
 *
 * Cleaning up #defines.
 */
int main(int argc, char** argv) {

    RS_DEBUG->setLevel(RS_Debug::D_WARNING);

        QCoreApplication::setApplicationName(XSTR(QC_APPNAME));
#if QT_VERSION < 0x040400
        /* No such property in Qt 4.3 */
#else
        QCoreApplication::setApplicationVersion(XSTR(QC_VERSION));
#endif


    QApplication app(argc, argv);
#if defined(Q_OS_MAC) && QT_VERSION > 0x050000
//need stylesheet for Qt5 on mac
    app.setStyleSheet(
"QToolButton:checked"
"{"
"    background-color: rgb(160,160,160);"
"    border-style: inset;"
"}"
""
"QToolButton"
"{"
"    background-color: transparent;"
"}"
""
"QToolButton:hover"
"{"
"    background-color: rgb(255,255,255);"
"    border-style: outset;"
"}"
                );
#endif


        // for image mime resources from png files
        //  TODO: kinda dirty to call that explicitly
//        QINITIMAGES_LIBRECAD();
#ifdef RS_SCRIPTING
//	qInitImages_librecad();
#endif

        const QString lpDebugSwitch0("-d"),lpDebugSwitch1("--debug") ;
        const QString help0("-h"), help1("--help");
        bool allowOptions=true;
        QList<int> argClean;
        for (int i=0; i<argc; i++) {
            QString argstr(argv[i]);
            if(allowOptions&&QString::compare("--", argstr)==0){
                allowOptions=false;
                continue;
            }

            if (allowOptions&&(
                        help0.compare(argstr, Qt::CaseInsensitive)==0 ||
                        help1.compare(argstr, Qt::CaseInsensitive)==0
                        )
                    ){//hep information
                qDebug()<<"librecad::usage: <options> <dxf file>";
                qDebug()<<"-h, --help\tdisplay this message";
                qDebug()<<"";
                qDebug()<<" --help\tdisplay this message";
                qDebug()<<"-d, --debug <level>";
                RS_DEBUG->print( RS_Debug::D_NOTHING, "possible debug levels:");
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Nothing", RS_Debug::D_NOTHING);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Critical", RS_Debug::D_CRITICAL);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Error", RS_Debug::D_ERROR);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Warning", RS_Debug::D_WARNING);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Notice", RS_Debug::D_NOTICE);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Informational", RS_Debug::D_INFORMATIONAL);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Debugging", RS_Debug::D_DEBUGGING);
                exit(0);

            }
            if ( allowOptions&& (
                     argstr.startsWith(lpDebugSwitch0, Qt::CaseInsensitive)||
                     argstr.startsWith(lpDebugSwitch1, Qt::CaseInsensitive)
                     )
                 ){
                argClean<<i;

                // to control the level of debugging output use --debug with level 0-6, e.g. --debug3
                // for a list of debug levels use --debug?
                // if no level follows, the debugging level is set
                argstr.remove(QRegExp("^"+lpDebugSwitch0));
                argstr.remove(QRegExp("^"+lpDebugSwitch1));
                char level;
                if(argstr.size()==0){
                    if(i+1<argc) {
                        if(QRegExp("\\d*").exactMatch(argv[i+1])){
                            ++i;
                            qDebug()<<"reading "<<argv[i]<<" as debugging level";
                            level=argv[i][0];
                            argClean<<i;
//.........这里部分代码省略.........
开发者ID:rmamba,项目名称:LibreCAD,代码行数:101,代码来源:main.cpp


示例15: check_mod

static modinfo check_mod(Relation &R, int o, bool tightmod)
{
  // R must be a single conjunct

  modinfo m, badm;
  m.modbase = 0;
  m.input_var = 0;
  m.input_var_coef = 0;
  badm = m;

  if (tcodegen_debug)
    {
      fprintf(DebugFile, "%s%s%d%s\n", debug_mark_cp,
	      "looking for mod substitution for output variable #",
	      o,
	      " in relation");
      fprintf(DebugFile, "%s", debug_mark_cp);
      R.print_with_subs(DebugFile);
    }


  // look for:  exists k s.t. 0 <= o < modbase && o = i + offset + k * modbase

  Variable_ID ov = R.output_var(o);
  Variable_ID k = 0;

  // Start by looking for
  //	exists k s.t.  o = i_coef * i + offset + k * modbase
  // We may also need to ignore "modbase * anything_else" terms,
  //  which we call "junk terms".
  // This is most easily done if we just hunt down modbase first

  DNF_Iterator di(R.query_DNF());
  for (EQ_Iterator ei = (*di)->EQs(); ei; ei++)
    {
      int o_coef = (*ei).get_coef(ov);
      if (o_coef != 0)
	{
	  if (m.modbase   != 0 ||  // there can be ... only one
	      abs(o_coef) != 1)    // above form requires this
	    return badm;

	  assert(m.input_var == 0);

	  // First, just figure out what modbase is
	  // Currently just find the (hopefully unique) wildcard/exists var.
	  // This does not allow junk wildcard terms.

	  for (Constr_Vars_Iter cvi(*ei); cvi; cvi++)
	    {
	      Variable_ID v = (*cvi).var;
	      int v_coef    = (*cvi).coef;

	      if ((v->kind() == Wildcard_Var ||
		   v->kind() == Exists_Var))
		{
		  if (m.modbase == 0)
		    {
		      m.modbase = abs(v_coef);
		      k = v;
		      assert(m.modbase != 0);
		    }
		  else
		    {
		      if (tcodegen_debug)
			{
			  fprintf(DebugFile, "%s%s\n", debug_mark_cp,
				  "giving up on possible junk wildcard term --"
				  " test, though simple, is not implemented");
			}
			return badm;
		    }
		}
	    }

 	  if (m.modbase == 0)
	    return badm;
	  assert(k);

	  {   // extra braces apparently avoid Visual C++ bug
	  for (Constr_Vars_Iter cvi(*ei); cvi; cvi++)
	    {
	      Variable_ID v = (*cvi).var;
	      int v_coef    = (*cvi).coef;
	      // we could find i, k (again), ov (again), junk, or a problem
	      // throw out junk terms first, in case of junk i before real i
	      if ((v_coef % m.modbase) != 0)
		{
		  if ((v->kind() == Input_Var) && // found i
		      m.input_var == 0)		  // there can be ... only one
		    {
		      assert(v_coef);
		      assert(abs(o_coef) == 1);
		      m.input_var_coef = v_coef * -o_coef;
		      m.input_var = v->get_position();
		      assert(m.input_var != 0);
		    }
		  else if (v != ov)
		    {
		      // Anything else is a legal junk term or "k" again
//.........这里部分代码省略.........
开发者ID:LittleForker,项目名称:the-omega-project,代码行数:101,代码来源:mmap-sub.c


示例16: QgsDebugMsg

void QgsGrassVectorMapLayer::load()
{
  QgsDebugMsg( "entered" );
  clear();

  if ( !mMap )
  {
    return;
  }

  // Attributes are not loaded for topo layers in which case field == 0
  if ( mField == 0 )
  {
    return;
  }

  QgsDebugMsg( QString( "cidxFieldIndex() = %1 cidxFieldNumCats() = %2" ).arg( cidxFieldIndex() ).arg( cidxFieldNumCats() ) );

  mFieldInfo = Vect_get_field( mMap->map(), mField ); // should work also with field = 0

  if ( !mFieldInfo )
  {
    QgsDebugMsg( "No field info -> no attribute table" );
  }
  else
  {
    QgsDebugMsg( "Field info found -> open database" );

    QFileInfo di( mMap->grassObject().mapsetPath() + "/vector/" + mMap->grassObject().name() + "/dbln" );
    mLastLoaded = di.lastModified();

    QgsGrass::lock();
    dbDriver *databaseDriver = 0;
    QString error = QString( "Cannot open database %1 by driver %2" ).arg( mFieldInfo->database ).arg( mFieldInfo->driver );
    G_TRY
    {
      databaseDriver = db_start_driver_open_database( mFieldInfo->driver, mFieldInfo->database );
    }
    G_CATCH( QgsGrass::Exception &e )
    {
      QgsGrass::warning( error + " : " + e.what() );
    }

    if ( !databaseDriver )
    {
      QgsDebugMsg( error );
    }
    else
    {
      QgsDebugMsg( "Database opened -> open select cursor" );
      dbString dbstr;
      db_init_string( &dbstr );
      db_set_string( &dbstr, ( char * )"select * from " );
      db_append_string( &dbstr, mFieldInfo->table );

      QgsDebugMsg( QString( "SQL: %1" ).arg( db_get_string( &dbstr ) ) );
      dbCursor databaseCursor;
      if ( db_open_select_cursor( databaseDriver, &dbstr, &databaseCursor, DB_SCROLL ) != DB_OK )
      {
        db_close_database_shutdown_driver( databaseDriver );
        QgsGrass::warning( "Cannot select attributes from table '" + QString( mFieldInfo->table ) + "'" );
      }
      else
      {
#ifdef QGISDEBUG
        int nRecords = db_get_num_rows( &databaseCursor );
        QgsDebugMsg( QString( "Number of records: %1" ).arg( nRecords ) );
#endif

        dbTable  *databaseTable = db_get_cursor_table( &databaseCursor );
        int nColumns = db_get_table_number_of_columns( databaseTable );

        // Read columns' description
        for ( int i = 0; i < nColumns; i++ )
        {
          QPair<double, double> minMax( DBL_MAX, -DBL_MAX );

          dbColumn *column = db_get_table_column( databaseTable, i );

          int ctype = db_sqltype_to_Ctype( db_get_column_sqltype( column ) );
          QVariant::Type qtype = QVariant::String; //default to string
          QgsDebugMsg( QString( "column = %1 ctype = %2" ).arg( db_get_column_name( column ) ).arg( ctype ) );

          QString ctypeStr;
          switch ( ctype )
          {
            case DB_C_TYPE_INT:
              ctypeStr = "integer";
              qtype = QVariant::Int;
              break;
            case DB_C_TYPE_DOUBLE:
              ctypeStr = "double";
              qtype = QVariant::Double;
              break;
            case DB_C_TYPE_STRING:
              ctypeStr = "string";
              qtype = QVariant::String;
              break;
            case DB_C_TYPE_DATETIME:
              ctypeStr = "datetime";
//.........这里部分代码省略.........
开发者ID:spatialthoughts,项目名称:QGIS,代码行数:101,代码来源:qgsgrassvectormaplayer.cpp


示例17: desperate_check_mod_kludge_for_time_skewing

static String desperate_check_mod_kludge_for_time_skewing(Relation &R, int o)
{
  Variable_ID Out_1, Out_3, In_4, In_8, alpha, v, k1, k2, k3, k4;
  int Out_1_coef, Out_3_coef, v_coef, const_term;
  int sign;
  F_Exists *exists_k1, *exists_k1k2, *exists_k3, *exists_k4;
  F_And *st_k1, *st_k1k2, *st_k3, *st_k4;
  GEQ_Handle geq_L_k1, geq_U_k1, geq_L_k3, geq_U_k3, geq_L_k4, geq_U_k4;
  EQ_Handle eq_k1, eq_k3, eq_k4;

  // R must be a single conjunct


  // PROBLEM:  FOR SOME REASON, THE RELEVANT EQUALITY SHOWS UP AS
  // 	t8 == 7+8*xbmod2+8*t4+Out_3+16*alpha  // note Out_1 is xbmod2
  // WHEN WE DO PRINT_WITH SUBS, BUT THE "TRUE" FORM IS
  //	8*xbmod2+8*t4+t8 == 7+Out_3+16*alpha
  // AS EVIDENCED BY THIS prefix_print.
  //
  // IS THIS CORRECT?  PRESUMABLY SO...
  // BASED ON AN UNDERSTANDING OF HOW ITS CORRECT, WE NEED TO
  // GENERALIZE OR CHANGE THE TEST BELOW.

  // R.prefix_print(stdout);

  if (tcodegen_debug)
    {
      fprintf(DebugFile, "%s%s\n", debug_mark_cp,
	      "desperately looking for special case mod and div substitution.");
    }

  // check that the only EQ constraint using Out_1 and Out_3 is of the form
  //	exists alpha : 8*Out_1 + 8*In_4 + In_8 == 7 + Out_3 + 16*alpha

  Out_1 = R.output_var(1);
  Out_3 = R.output_var(3);
  In_4=0, In_8=0, alpha=0;	// look for these vars in the loop --
				// In_4 must play the appropriate role
				// in the equality above, but may not
				// actually be the 4th input variable.
  DNF_Iterator di(R.query_DNF());

  // This loop looks for any one equality of the right form.
  // We we find it, we break out of t 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ di_devfs_path函数代码示例发布时间:2022-05-30
下一篇:
C++ dhd_wl_ioctl_cmd函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap