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

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

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

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

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

示例1: dnssock

dnssock_udp::dnssock_udp (int f, cb_t cb)  : dnssock (false, cb), fd (f){  fdcb (fd, selread, wrap (this, &dnssock_udp::rcb));}
开发者ID:dougc333,项目名称:sfs_eventdrivenc--templatelibrary,代码行数:5,


示例2: wrap

VALUE wrap< sf::View >(const sf::View &image ){	return wrap(const_cast<sf::View*>(&image));}
开发者ID:Hanmac,项目名称:sfml-ruby,代码行数:4,


示例3: act

void act(gamedata &g, int jx, int jy, bool jb){  // Reset hidden/afterburner status  g.p().hide = false;  g.p().boost = false;  g.p().gunthreat = 0;  switch(g.p().state){    case 0: // OK planes      switch(g.p().land){        case 0: // Stationary on runway          // Check for mission 0 and mission 1 wins          if (((g.mission == 0) || (g.mission == 1)) && (!g.p().drak) &&              (g.p().score >= g.targetscore)){            g.winner = g.p().side;          }          // Start Engine          if (jy == -1){            g.p().s = 0.3*GAME_SPEED*GAME_SPEED;            g.p().land = 1;            if ((g.p().control) > 0){              g.sound.volume(g.p().control-1, 0.0);              g.sound.loop(g.p().control-1, g.p().enginesample);            }          }          break;        case 1: // Taking off plane          if (jy == -1){            g.p().s = dlimit(g.p().s + 0.3*GAME_SPEED*GAME_SPEED, 0.0,                            6.0*GAME_SPEED);          }          // Take off plane          if ((jx == -1) && (g.p().s > 2.0*GAME_SPEED) &&              (g.base[g.p().side].planed == 13)){            g.p().d++;            g.p().rotate = g.p().maxrotate;            g.p().land = 2;          }          if ((jx == 1) && (g.p().s > 2.0*GAME_SPEED) &&              (g.base[g.p().side].planed == 5)){            g.p().d--;            g.p().rotate = g.p().maxrotate;            g.p().land = 2;          }          // Off end of runway          if (abs(int(g.p().x - g.base[g.p().side].planex)) >               g.base[g.p().side].runwaylength){            g.p().land = 2;          }          break;        case 2: // flying          // Navigate plane          if ((g.p().rotate == 0) && (jx !=0)){            g.p().d = wrap(g.p().d-jx,1,17);            g.p().rotate = g.p().maxrotate;          }else{            if (g.p().rotate > 0){              g.p().rotate--;            }          }          // Acceleration / Afterburner Controls          {            double acceleration = g.accel[g.p().d] * GAME_SPEED * GAME_SPEED;            if (g.p().burner){              if (jy == -1){                acceleration += 0.3*GAME_SPEED*GAME_SPEED;                g.p().boost = true;              }              if ((g.p().s > 6.0*GAME_SPEED) && (jy != -1)){                acceleration -= 0.3*GAME_SPEED*GAME_SPEED;              }              g.p().s = dlimit(g.p().s + acceleration, 0.0, 12.0*GAME_SPEED);            }else{              g.p().s = dlimit(g.p().s + acceleration, 0.0, 6.0*GAME_SPEED);            }          }          // Stealth Controls          if ((jy == -1) && (jx == 0) && (!jb) && (g.p().stealth)){            g.p().hide = true;          }          // Check for shotfire          if (g.p().shotdelay == 0){            if ((jb) && (g.p().ammo > 0)){              fire_shot(g.p(), g.shot, g.sound, g.xmove, g.ymove);                          }            // Check for bombdrop            if ((jy == 1) && (g.p().bombs > 0)){              drop_bomb(g.p(), g.fall, g.sound, g.bombimage);            }          }else{            g.p().shotdelay--;          }          break;        case 3: // Landing plane          if ((((g.p().x - g.base[g.p().side].planex) < 2.0) &&               (g.base[g.p().side].planed == 13)) ||//.........这里部分代码省略.........
开发者ID:kokopalen,项目名称:rs97_emulator,代码行数:101,


示例4: attribute

inline string attribute(unsigned short type, unsigned short acclaim, int p, int value, int minVal, int maxVal, int step, unit valueUnit) {    string result;    char tempStr[4];    snprintf(tempStr, 4, "%d", value);    if (p & premission_read) {        result += wrap("value")+":"+tempStr;        result += ",";    }    snprintf(tempStr, 4, "%d", minVal);    if (minVal != INT32_MIN)        result += wrap("minValue")+":"+tempStr+",";    snprintf(tempStr, 4, "%d", maxVal);    if (maxVal != INT32_MAX)        result += wrap("maxValue")+":"+tempStr+",";    snprintf(tempStr, 4, "%d", step);    if (step > 0)        result += wrap("minStep")+":"+tempStr+",";    result += wrap("perms")+":";    result += "[";    if (p & premission_read) result += wrap("pr")+",";    if (p & premission_write) result += wrap("pw")+",";    if (p & premission_notify) result += wrap("ev")+",";    result = result.substr(0, result.size()-1);    result += "]";    result += ",";    snprintf(tempStr, 4, "%X", type);    result += wrap("type")+":"+wrap(tempStr);    result += ",";    snprintf(tempStr, 4, "%hd", acclaim);    result += wrap("iid")+":"+tempStr;    result += ",";    switch (valueUnit) {    case unit_arcDegree:        result += wrap("unit")+":"+wrap("arcdegrees")+",";        break;    case unit_celsius:        result += wrap("unit")+":"+wrap("celsius")+",";        break;    case unit_percentage:        result += wrap("unit")+":"+wrap("percentage")+",";        break;    }    result += "/"format/":/"int/"";    return "{"+result+"}";}
开发者ID:careyjou,项目名称:Personal-HomeKit-HAP,代码行数:56,


示例5: wrap

 void RaceDialog::onSelectNextFace(MyGUI::Widget*) {     mFaceIndex = wrap(mFaceIndex + 1, mAvailableHeads.size());     updatePreview(); }
开发者ID:S0rcerer,项目名称:openmw,代码行数:5,


示例6: ASSERT

bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChunksize ){	ASSERT( !m_bBufferLocked );	iChunksize *= bytes_per_frame();	DWORD iCursorStart, iCursorEnd;	HRESULT result;	/* It's easiest to think of the cursor as a block, starting and ending at	 * the two values returned by GetCurrentPosition, that we can't write to. */	result = m_pBuffer->GetCurrentPosition( &iCursorStart, &iCursorEnd );#ifndef _XBOX	if( result == DSERR_BUFFERLOST )	{		m_pBuffer->Restore();		result = m_pBuffer->GetCurrentPosition( &iCursorStart, &iCursorEnd );	}	if( result != DS_OK )	{		LOG->Warn( hr_ssprintf(result, "DirectSound::GetCurrentPosition failed") );		return false;	}#endif	memmove( &m_iLastCursors[0][0], &m_iLastCursors[1][0], sizeof(int)*6 );	m_iLastCursors[3][0] = iCursorStart;	m_iLastCursors[3][1] = iCursorEnd;	/* Some cards (Creative AudioPCI) have a no-write area even when not playing.  I'm not	 * sure what that means, but it breaks the assumption that we can fill the whole writeahead	 * when prebuffering. */	if( !m_bPlaying )		iCursorEnd = iCursorStart;	/*	 * Some cards (Game Theater XP 7.1 hercwdm.sys 5.12.01.4101 [466688b, 01-10-2003])	 * have odd behavior when starting a sound: the start/end cursors go:	 *	 * 0,0             end cursor forced equal to start above (normal)	 * 4608, 1764      end cursor trailing the write cursor; except with old emulated	 *                   WaveOut devices, this shouldn't happen; it indicates that the	 *                   driver expects almost the whole buffer to be filled.  Also, the	 *                   play cursor is too far ahead from the last call for the amount	 *                   of actual time passed.	 * 704, XXX        start cursor moves back to where it should be.  I don't have an exact	 *                   end cursor position, but in general from now on it stays about 5kb	 *                   ahead of start (which is where it should be).	 *	 * The second call is completely wrong; both the start and end cursors are meaningless.	 * Detect this: if the end cursor is close behind the start cursor, don't do anything.	 * (We can't; we have no idea what the cursors actually are.)	 */	{		int iPrefetch = iCursorEnd - iCursorStart;		wrap( iPrefetch, m_iBufferSize );		if( m_iBufferSize - iPrefetch < 1024*4 )		{			LOG->Trace( "Strange DirectSound cursor ignored: %i..%i", iCursorStart, iCursorEnd );			return false;		}	}	/* Update m_iBufferBytesFilled. */	{		int iFirstByteFilled = m_iWriteCursor - m_iBufferBytesFilled;		wrap( iFirstByteFilled, m_iBufferSize );		/* The number of bytes that have been played since the last time we got here: */		int bytes_played = iCursorStart - iFirstByteFilled;		wrap( bytes_played, m_iBufferSize );		m_iBufferBytesFilled -= bytes_played;		m_iBufferBytesFilled = max( 0, m_iBufferBytesFilled );		if( m_iExtraWriteahead )		{			int used = min( m_iExtraWriteahead, bytes_played );			CString s = ssprintf("used %i of %i (%i..%i)", used, m_iExtraWriteahead, iCursorStart, iCursorEnd );			s += "; last: ";			for( int i = 0; i < 4; ++i )				s += ssprintf( "%i, %i; ", m_iLastCursors[i][0], m_iLastCursors[i][1] );			LOG->Trace("%s", s.c_str());			m_iWriteAhead -= used;			m_iExtraWriteahead -= used;		}	}	CheckWriteahead( iCursorStart, iCursorEnd );	CheckUnderrun( iCursorStart, iCursorEnd );	/* If we already have enough bytes written ahead, stop. */	if( m_iBufferBytesFilled > m_iWriteAhead )		return false;	int iNumBytesEmpty = m_iWriteAhead - m_iBufferBytesFilled;	/* num_bytes_empty is the amount of free buffer space.  If it's//.........这里部分代码省略.........
开发者ID:BitMax,项目名称:openitg,代码行数:101,


示例7: prepare_galaxy_for_output

void prepare_galaxy_for_output(int n, struct GALAXY *g, struct GALAXY_OUTPUT *o)#endif{  int j,ibin;#ifndef NO_PROPS_OUTPUTS  o->Type = g->Type;  o->SnapNum = g->SnapNum;  o->CentralMvir = get_virial_mass(Halo[g->HaloNr].FirstHaloInFOFgroup);  o->CentralRvir = get_virial_radius(Halo[g->HaloNr].FirstHaloInFOFgroup);  o->Mvir = g->Mvir;  o->Rvir = g->Rvir;  o->Vvir = g->Vvir;  for(j = 0; j < 3; j++)    {	  o->Pos[j] = g->Pos[j];	  o->DistanceToCentralGal[j] = wrap(Halo[Halo[g->HaloNr].FirstHaloInFOFgroup].Pos[j] - g->Pos[j],BoxSize);;    }  o->ColdGas = g->ColdGas;  o->DiskMass = g->DiskMass;  o->BulgeMass = g->BulgeMass;  o->HotGas = g->HotGas;  o->BlackHoleMass = g->BlackHoleMass;#endif#ifdef COMPUTE_SPECPHOT_PROPERTIES#ifndef POST_PROCESS_MAGS#ifdef OUTPUT_REST_MAGS   /* Luminosities are converted into Mags in various bands */  for(j = 0; j < NMAG; j++) 	o->Mag[j] = lum_to_mag(g->Lum[j][n]);#endif#endif //ndef POST_PROCESS_MAGS#endif //COMPUTE_SPECPHOT_PROPERTIES#ifndef LIGHT_OUTPUT  #ifndef NO_PROPS_OUTPUTS#ifdef GALAXYTREE  o->HaloID = HaloIDs[g->HaloNr].HaloID;  o->Redshift = ZZ[g->SnapNum];  int ii = (int) floor(o->Pos[0] * ScaleFactor);  int jj = (int) floor(o->Pos[1] * ScaleFactor);  int kk = (int) floor(o->Pos[2] * ScaleFactor);  o->PeanoKey = peano_hilbert_key(ii, jj, kk, Hashbits);  o->SubID = calc_big_db_subid_index(g->SnapNum, Halo[g->HaloNr].FileNr, Halo[g->HaloNr].SubhaloIndex);  int tmpfirst = Halo[g->HaloNr].FirstHaloInFOFgroup;  int lenmax = 0;  int next = tmpfirst;  while(next != -1)    {      if(Halo[next].Len > lenmax)	{	  lenmax = Halo[next].Len;	  tmpfirst = next;	}      next = Halo[next].NextHaloInFOFgroup;    }  o->MMSubID = calc_big_db_subid_index(g->SnapNum, Halo[tmpfirst].FileNr, Halo[tmpfirst].SubhaloIndex);#endif  o->LookBackTimeToSnap = NumToTime(g->SnapNum)*UnitTime_in_years/Hubble_h;  o->InfallVmax = g->InfallVmax;  o->InfallSnap = g->InfallSnap;  o-> InfallHotGas = g-> InfallHotGas;  o->HotRadius =  g->HotRadius;#ifdef HALOPROPERTIES  o->HaloM_Mean200 = g->HaloM_Mean200;  o->HaloM_Crit200 = g->HaloM_Crit200;  o->HaloM_TopHat = g->HaloM_TopHat;  o->HaloVelDisp = g->HaloVelDisp;  o->HaloVmax = g->HaloVmax;#endif  o->Len = g->Len;  o->Vmax = g->Vmax;  o->BulgeSize = g->BulgeSize;  o->EjectedMass = g->EjectedMass;  o->BlackHoleGas = g->BlackHoleGas;  for(j = 0; j < 3; j++)    {      o->Vel[j] = g->Vel[j];#ifdef HALOSPIN      o->HaloSpin[j] = g->HaloSpin[j];#endif#ifndef H2_AND_RINGS      o->GasSpin[j] = g->GasSpin[j];      o->StellarSpin[j] = g->StellarSpin[j];#else      o->DiskSpin[j] = g->DiskSpin[j];//.........这里部分代码省略.........
开发者ID:boywert,项目名称:SussexBigRun2013,代码行数:101,


示例8: ceilf

void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives ){	if( m_SubActors.empty() )		return;	float fNumItemsToDraw = m_fNumItemsToDraw;	if( m_quadMask.GetVisible() )	{		// write to z buffer so that top and bottom are clipped		// Draw an extra item; this is the one that will be masked.		fNumItemsToDraw++;		float fPositionFullyOffScreenTop = -(fNumItemsToDraw)/2.f;		float fPositionFullyOffScreenBottom = (fNumItemsToDraw)/2.f;		m_exprTransformFunction.TransformItemCached( m_quadMask, fPositionFullyOffScreenTop, -1, m_iNumItems );		if( bDrawPrimitives )	m_quadMask.Draw();		m_exprTransformFunction.TransformItemCached( m_quadMask, fPositionFullyOffScreenBottom, m_iNumItems, m_iNumItems );		if( bDrawPrimitives )	m_quadMask.Draw();	}	float fFirstItemToDraw = m_fCurrentItem - fNumItemsToDraw/2.f;	float fLastItemToDraw = m_fCurrentItem + fNumItemsToDraw/2.f;	int iFirstItemToDraw = (int) ceilf( fFirstItemToDraw );	int iLastItemToDraw = (int) ceilf( fLastItemToDraw );	if( !m_bLoop )	{		iFirstItemToDraw = clamp( iFirstItemToDraw, 0, m_iNumItems );		iLastItemToDraw = clamp( iLastItemToDraw, 0, m_iNumItems );	}	bool bDelayedDraw = m_bDrawByZPosition && !m_bLoop;	vector<Actor*> subs;	{		// Shift m_SubActors so iFirstItemToDraw is at the beginning.		int iNewFirstIndex = iFirstItemToDraw;		int iDist = iNewFirstIndex - m_iFirstSubActorIndex;		m_iFirstSubActorIndex = iNewFirstIndex;		ShiftSubActors( iDist );	}	int iNumToDraw = iLastItemToDraw - iFirstItemToDraw;	for( int i = 0; i < iNumToDraw; ++i )	{		int iItem = i + iFirstItemToDraw;		float fPosition = iItem - m_fCurrentItem;		int iIndex = i; // index into m_SubActors		if( m_bLoop )			wrap( iIndex, m_SubActors.size() );		else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() )			continue;		// Optimization: Zero out unused parameters so that they don't create new,		// unnecessary  entries in the position cache. On scrollers with lots of		// items, especially with Subdivisions > 1, m_exprTransformFunction uses		// too much memory.		if( !m_bFunctionDependsOnPositionOffset )			fPosition = 0;		if( !m_bFunctionDependsOnItemIndex )			iItem = 0;		m_exprTransformFunction.TransformItemCached( *m_SubActors[iIndex], fPosition, iItem, m_iNumItems );		if( bDrawPrimitives )		{			if( bDelayedDraw )				subs.push_back( m_SubActors[iIndex] );			else				m_SubActors[iIndex]->Draw();		}	}	if( bDelayedDraw )	{		ActorUtil::SortByZPosition( subs );		FOREACH( Actor*, subs, a )			(*a)->Draw();	}}
开发者ID:takanoter,项目名称:stepmania,代码行数:79,


示例9: _alloc

VALUE _alloc(VALUE self){	return wrap(new Ogre::RotationalSpline);}
开发者ID:Hanmac,项目名称:libogre-ruby,代码行数:4,


示例10: _get

VALUE _get(VALUE self,VALUE index){	if(NUM2UINT(index) < _self->getNumPoints())		return wrap(_self->getPoint(NUM2ULONG(index)));	return Qnil;}
开发者ID:Hanmac,项目名称:libogre-ruby,代码行数:6,


示例11: prepare_galaxy_for_output

 /*@brief Copies all the relevant properties from the Galaxy structure        into the Galaxy output structure, some units are corrected.*/void prepare_galaxy_for_output(int n, struct GALAXY *g, struct GALAXY_OUTPUT *o){  int j;  o->Type = g->Type;  o->SnapNum = g->SnapNum;  o->CentralMvir = get_virial_mass(Halo[g->HaloNr].FirstHaloInFOFgroup);  o->Mvir = g->Mvir;  o->Rvir = g->Rvir;  o->Vvir = g->Vvir;  for(j = 0; j < 3; j++)    {	  o->Pos[j] = g->Pos[j];	  o->DistanceToCentralGal[j] = wrap(Halo[Halo[g->HaloNr].FirstHaloInFOFgroup].Pos[j] - g->Pos[j],BoxSize);;    }  o->ColdGas = g->ColdGas;  o->DiskMass = g->DiskMass;  o->BulgeMass = g->BulgeMass;  o->HotGas = g->HotGas;  o->BlackHoleMass = g->BlackHoleMass;#ifndef POST_PROCESS_MAGS#ifdef OUTPUT_REST_MAGS  /* Luminosities are converted into Mags in various bands */  for(j = 0; j < NMAG; j++) 	o->Mag[j] = lum_to_mag(g->Lum[j][n]);#endif#endif#ifndef LIGHT_OUTPUT  #ifdef GALAXYTREE  o->HaloID = HaloIDs[g->HaloNr].HaloID;  o->Redshift = ZZ[g->SnapNum];  int ii = (int) floor(o->Pos[0] * ScaleFactor);  int jj = (int) floor(o->Pos[1] * ScaleFactor);  int kk = (int) floor(o->Pos[2] * ScaleFactor);  o->PeanoKey = peano_hilbert_key(ii, jj, kk, Hashbits);  o->SubID = calc_big_db_subid_index(g->SnapNum, Halo[g->HaloNr].FileNr, Halo[g->HaloNr].SubhaloIndex);  int tmpfirst = Halo[g->HaloNr].FirstHaloInFOFgroup;  int lenmax = 0;  int next = tmpfirst;  while(next != -1)    {      if(Halo[next].Len > lenmax)	{	  lenmax = Halo[next].Len;	  tmpfirst = next;	}      next = Halo[next].NextHaloInFOFgroup;    }  o->MMSubID = calc_big_db_subid_index(g->SnapNum, Halo[tmpfirst].FileNr, Halo[tmpfirst].SubhaloIndex);#endif  o->LookBackTimeToSnap = NumToTime(g->SnapNum)*UnitTime_in_years/Hubble_h;  o->InfallVmax = g->InfallVmax;  o->InfallSnap = g->InfallSnap;  o->HotRadius =  g->HotRadius;#ifdef HALOPROPERTIES  o->HaloM_Mean200 = g->HaloM_Mean200;  o->HaloM_Crit200 = g->HaloM_Crit200;  o->HaloM_TopHat = g->HaloM_TopHat;  o->HaloVelDisp = g->HaloVelDisp;  o->HaloVmax = g->HaloVmax;#endif  o->Len = g->Len;  o->Vmax = g->Vmax;  o->BulgeSize = g->BulgeSize;  o->EjectedMass = g->EjectedMass;  o->BlackHoleGas = g->BlackHoleGas;  for(j = 0; j < 3; j++)    {      o->Vel[j] = g->Vel[j];#ifdef HALOSPIN      o->HaloSpin[j] = g->HaloSpin[j];#endif      o->GasSpin[j] = g->GasSpin[j];      o->StellarSpin[j] = g->StellarSpin[j];#ifdef HALOPROPERTIES      o->HaloPos[j] = g->HaloPos[j];      o->HaloVel[j] = g->HaloVel[j];      o->HaloSpin[j] = g->HaloSpin[j];#endif          }  o->XrayLum = g->XrayLum;  o->GasDiskRadius = g->GasDiskRadius;//.........这里部分代码省略.........
开发者ID:boywert,项目名称:SussexBigRun2013,代码行数:101,


示例12: _runWizard

VALUE _runWizard(VALUE self,VALUE page){	return wrap(_self->RunWizard(wrap<wxWizardPage*>(page)));}
开发者ID:ileitch,项目名称:rwx,代码行数:4,


示例13: main

intmain (int argc, char **argv){  pid_t child;  int an;  vec<char *> av;  char *fname = NULL;  char *basename;  enum { BAD, HEADER, CFILE, PYTHON } mode = BAD;  void (*fn) (str) = NULL;  int len;  av.push_back (PATH_CPP);  av.push_back ("-DRPCC");  av.push_back (NULL);  for (an = 1; an < argc; an++) {    char *arg = argv[an];    int arglen = strlen (arg);    if (arg[0] == '-' && (arg[1] == 'D' || arg[1] == 'I'))      av.push_back (arg);    else if (!fname && arglen > 2 && arg[0] != '-'	     && arg[arglen-1] == 'x' && arg[arglen-2] == '.')      fname = arg;    else if (!strcmp (arg, "-h") && mode == BAD)      mode = HEADER;    else if (!strcmp (arg, "-c") && mode == BAD)      mode = CFILE;    else if (!strcmp (arg, "-python") && mode == BAD)      mode = PYTHON;    else if (!strcmp (arg, "-o") && !outfile && ++an < argc)      outfile = argv[an];    else if (!strncmp (arg, "-o", 2) && !outfile && arg[2])      outfile = arg + 2;    else if (!strcmp (arg, "-P") && !idprefix && ++an < argc)      idprefix = argv[an];    else if (!strncmp (arg, "-P", 2) && !idprefix && arg[2])      idprefix = arg + 2;    else       usage ();  }  if (!fname)    usage ();  if (idprefix)    idprefix = idprefix << "_";  av.push_back (fname);  av.push_back (NULL);  if ((basename = strrchr (fname, '/')))    basename++;  else    basename = fname;  len = strlen (basename);  switch (mode) {  case HEADER:    av[2] = "-DRPCC_H";    fn = genheader;    if (!outfile)      outfile = strbuf ("%.*sh", len - 1, basename);    break;  case CFILE:    av[2] = "-DRPCC_C";    fn = gencfile;    if (!outfile)      outfile = strbuf ("%.*sC", len - 1, basename);    break;  case PYTHON:    av[2] = "-DRPCC_P";    fn = genpython;    if (!outfile)      outfile = strbuf ("%.*spy", len - 1, basename);     break;  default:    usage ();    break;  }  child = runcpp (av.base ());  if (outfile != "-") {    if (outfile[0] != '|')      atexit (cleanup);    setstdout ();  }  make_sync (0);  yyparse ();  checkliterals ();  if (outfile != "-" && outfile[0] != '|')    fn (outfile);  else    fn (fname);#if 0  chldcb (child, wrap (reapcpp));  amain ();#else//.........这里部分代码省略.........
开发者ID:bougyman,项目名称:sfs,代码行数:101,


示例14: do_one_pass

static int do_one_pass(journal_t *journal,			struct recovery_info *info, enum passtype pass){	unsigned int		first_commit_ID, next_commit_ID;	unsigned long long	next_log_block;	int			err, success = 0;	journal_superblock_t *	sb;	journal_header_t *	tmp;	struct buffer_head *	bh;	unsigned int		sequence;	int			blocktype;	int			tag_bytes = journal_tag_bytes(journal);	__u32			crc32_sum = ~0; /* Transactional Checksums */	/*	 * First thing is to establish what we expect to find in the log	 * (in terms of transaction IDs), and where (in terms of log	 * block offsets): query the superblock.	 */	sb = journal->j_superblock;	next_commit_ID = be32_to_cpu(sb->s_sequence);	next_log_block = be32_to_cpu(sb->s_start);	first_commit_ID = next_commit_ID;	if (pass == PASS_SCAN)		info->start_transaction = first_commit_ID;	jbd_debug(1, "Starting recovery pass %d/n", pass);	/*	 * Now we walk through the log, transaction by transaction,	 * making sure that each transaction has a commit block in the	 * expected place.  Each complete transaction gets replayed back	 * into the main filesystem.	 */	while (1) {		int			flags;		char *			tagp;		journal_block_tag_t *	tag;		struct buffer_head *	obh;		struct buffer_head *	nbh;		cond_resched();		/* If we already know where to stop the log traversal,		 * check right now that we haven't gone past the end of		 * the log. */		if (pass != PASS_SCAN)			if (tid_geq(next_commit_ID, info->end_transaction))				break;		jbd_debug(2, "Scanning for sequence ID %u at %llu/%lu/n",			  next_commit_ID, next_log_block, journal->j_last);		/* Skip over each chunk of the transaction looking		 * either the next descriptor block or the final commit		 * record. */		jbd_debug(3, "JBD: checking block %llu/n", next_log_block);		err = jread(&bh, journal, next_log_block);		if (err)			goto failed;		next_log_block++;		wrap(journal, next_log_block);		/* What kind of buffer is it?		 *		 * If it is a descriptor block, check that it has the		 * expected sequence number.  Otherwise, we're all done		 * here. */		tmp = (journal_header_t *)bh->b_data;		if (tmp->h_magic != cpu_to_be32(JFS_MAGIC_NUMBER)) {			brelse(bh);			break;		}		blocktype = be32_to_cpu(tmp->h_blocktype);		sequence = be32_to_cpu(tmp->h_sequence);		jbd_debug(3, "Found magic %d, sequence %d/n",			  blocktype, sequence);		if (sequence != next_commit_ID) {			brelse(bh);			break;		}		/* OK, we have a valid descriptor block which matches		 * all of the sequence number checks.  What are we going		 * to do with it?  That depends on the pass... */		switch(blocktype) {		case JFS_DESCRIPTOR_BLOCK:			/* If it is a valid descriptor block, replay it			 * in pass REPLAY; if journal_checksums enabled, then//.........这里部分代码省略.........
开发者ID:csmartin,项目名称:hddtest,代码行数:101,


示例15: do_one_pass

static int do_one_pass(journal_t *journal,            struct recovery_info *info, enum passtype pass){    unsigned int        first_commit_ID, next_commit_ID;    unsigned long        next_log_block;    int            err, success = 0;    journal_superblock_t *    sb;    journal_header_t *    tmp;    struct buffer_head *    bh;    unsigned int        sequence;    int            blocktype;    /* Precompute the maximum metadata descriptors in a descriptor block */    int            MAX_BLOCKS_PER_DESC;    MAX_BLOCKS_PER_DESC = ((journal->j_blocksize-sizeof(journal_header_t))                   / sizeof(journal_block_tag_t));    /*     * First thing is to establish what we expect to find in the log     * (in terms of transaction IDs), and where (in terms of log     * block offsets): query the superblock.     */    sb = journal->j_superblock;    next_commit_ID = be32_to_cpu(sb->s_sequence);    next_log_block = be32_to_cpu(sb->s_start);    first_commit_ID = next_commit_ID;    if (pass == PASS_SCAN)        info->start_transaction = first_commit_ID;    jbd_debug(1, "Starting recovery pass %d/n", pass);    /*     * Now we walk through the log, transaction by transaction,     * making sure that each transaction has a commit block in the     * expected place.  Each complete transaction gets replayed back     * into the main filesystem.     */    while (1) {        int            flags;        char *            tagp;        journal_block_tag_t *    tag;        struct buffer_head *    obh;        struct buffer_head *    nbh;        cond_resched();        /* If we already know where to stop the log traversal,         * check right now that we haven't gone past the end of         * the log. */        if (pass != PASS_SCAN)            if (tid_geq(next_commit_ID, info->end_transaction))                break;        jbd_debug(2, "Scanning for sequence ID %u at %lu/%lu/n",              next_commit_ID, next_log_block, journal->j_last);        /* Skip over each chunk of the transaction looking         * either the next descriptor block or the final commit         * record. */        jbd_debug(3, "JBD: checking block %ld/n", next_log_block);        err = jread(&bh, journal, next_log_block);        if (err)            goto failed;        next_log_block++;        wrap(journal, next_log_block);        /* What kind of buffer is it?         *         * If it is a descriptor block, check that it has the         * expected sequence number.  Otherwise, we're all done         * here. */        tmp = (journal_header_t *)bh->b_data;        if (tmp->h_magic != cpu_to_be32(JFS_MAGIC_NUMBER)) {            brelse(bh);            break;        }        blocktype = be32_to_cpu(tmp->h_blocktype);        sequence = be32_to_cpu(tmp->h_sequence);        jbd_debug(3, "Found magic %d, sequence %d/n",              blocktype, sequence);        if (sequence != next_commit_ID) {            brelse(bh);            break;        }        /* OK, we have a valid descriptor block which matches         * all of the sequence number checks.  What are we going         * to do with it?  That depends on the pass... */        switch(blocktype) {//.........这里部分代码省略.........
开发者ID:274914765,项目名称:C,代码行数:101,


示例16: fdcb

voidhclient_t::sched_read (){  selread_on = true;  fdcb (fd, selread, wrap (this, &hclient_t::canread));}
开发者ID:LeadsPlus,项目名称:okws,代码行数:6,


示例17: sched_tpt_measurement

static voidsched_tpt_measurement (){  delaycb (tpt_sample_period_secs, tpt_sample_period_nsecs, 	   wrap (tpt_do_sample, false));}
开发者ID:LeadsPlus,项目名称:okws,代码行数:6,


示例18: schedule_lose_patience_timer

voidschedule_lose_patience_timer (){  delaycb (1, 0, wrap (lose_patience_cb));}
开发者ID:LeadsPlus,项目名称:okws,代码行数:5,


示例19: m_x

json_introspection_server_t::json_introspection_server_t (ptr<axprt> x)  : m_x (x),     m_srv (asrv::alloc (x, s_prog, 			wrap (this, &json_introspection_server_t::dispatch),			false)){}
开发者ID:Keloran,项目名称:okws,代码行数:6,


示例20: main

//.........这里部分代码省略.........    // and port; therefore, they're going to be making their own URL    // by alternating static parts and cyclers.    if (req_cycler) {      warn << "Don't provide -r if you're going to make your own URI/n";      usage ();    }    if (svc_cycler) {      warn << "Don't provide -v if you're going to make your own URI/n";      usage ();    }    for (int i = 0; i < argc; i++) {      if (i % 2 == 0) {	uri_parts.push_back (argv[i]);      } else {	id_cycler_t *tmp = New id_cycler_t ();	if (!tmp->init (argv[i])) {	  warn << "Cannot parse ID cycler: " << argv[i] << "/n";	  usage ();	}	id_cyclers.push_back (tmp);      }    }  } else if (mode != NONE) {    // no manual URL building required; just specify some defaults    // though if none were specified    if (!req_cycler)       // roughly a million, but this way all reqs will have the same      // number of digits      req_cycler = New id_cycler_t (true, 900000, 100000);    if (!svc_cycler)      // don't cycle --- just always return 1      svc_cycler = New id_cycler_t (false, 1, 1);    id_cyclers.push_back (svc_cycler);    id_cyclers.push_back (req_cycler);    switch (mode) {    case SEDA:      uri_parts.push_back ("mt");      uri_parts.push_back ("?id=");      break;    case OKWS:       {	uri_parts.push_back ("mt"); 	strbuf b ("?");	if (no_pub) 	  b << "nopub=1&";	b << "id=";	uri_parts.push_back (b);	break;      }    case PHP:      uri_parts.push_back ("mt");      uri_parts.push_back (".php?id=");      break;    case FLASH:      uri_parts.push_back ("cgi-bin/mt");      uri_parts.push_back ("?");      break;    default:      break;    }  }  // normdist (mean, std-dev, "precision")  if (use_latencies)    dist = New normdist_t (200,25);  if (!hostport.match (dest))     usage ();  host = hostport[1];  str port_s = hostport[3];  if (port_s) {    if (!convertint (port_s, &port)) usage ();  } else {    port = 80;  }  struct timespec tsnow = sfs_get_tsnow ();  // unless we don this, shit won't be initialized, and i'll  // starting ripping my hair out as to why all of the timestamps  // are negative  clock_gettime (CLOCK_REALTIME, &tsnow);  nrunning = 0;  sdflag = true;  nreq = n;  nreq_fixed = n;  tpt_last_nreq = nreq;  if (delay) {    timecb (startat, wrap (main2, n));  } else {    main2 (n);  }  amain ();}
开发者ID:LeadsPlus,项目名称:okws,代码行数:101,


示例21: evolve_galaxies

//.........这里部分代码省略.........	  Gal[p].SnapNum = Halo[halonr].SnapNum;	  for (p = 0; p < ngal; p++)	  	for (nr = 0; nr < NCONES; nr++)	  		for (ix = 0; ix < NREPLICA; ix++)	  			for (iy = 0; iy < NREPLICA; iy++)	  				for (iz = 0; iz < NREPLICA; iz++)	  					inside_lightcone(p, istep, nr, ix, iy, iz);#endif    }/* end move forward in interval STEPS */    /* check the bulge size*/  //checkbulgesize_main(ngal);      for(p = 0; p < ngal; p++)    {	  if(Gal[p].Type == 2)        {	  	//if(halonr == 140)	  	//print_galaxy("check12", p, halonr);/*#ifdef UPDATETYPETWO		  update_type_two_coordinate_and_velocity(treenr, p, centralgal);#else*/#ifndef UPDATETYPETWO	  	int jj;	  	float tmppos;	  	for(jj = 0; jj < 3; jj++)	  	{	  		tmppos = wrap(Gal[p].DistanceToCentralGal[jj],BoxSize);	  		tmppos *=  (Gal[p].MergTime/Gal[p].OriMergTime);	  		Gal[p].Pos[jj] = Gal[p].MergCentralPos[jj] + tmppos;	  		if(Gal[p].Pos[jj] < 0)	  			Gal[p].Pos[jj] = BoxSize + Gal[p].Pos[jj];	  		if(Gal[p].Pos[jj] > BoxSize)	  			Gal[p].Pos[jj] = Gal[p].Pos[jj] - BoxSize;	  	}#endif      /* Disruption of type 2 galaxies. Type 1 galaxies are not disrupted since usually       * bayonic component is more compact than dark matter.*/#ifdef DISRUPTION	    //if(halonr == 84)	  	//print_galaxy("check13", p, halonr);		  disrupt(p, Gal[p].CentralGal);		  //if(halonr == 84)		  //print_galaxy("check014", p, halonr);#endif        }	  //if(halonr > 20 && halonr < 31)	  	//if(halonr ==140)	 		 // print_galaxy("check015", p, halonr);    }  for (p =0;p<ngal;p++) mass_checks("Evolve_galaxies #6",p);  
开发者ID:boywert,项目名称:L-Galaxy_RT,代码行数:66,


示例22: journal_find_head

errcode_t journal_find_head(journal_t *journal){	unsigned int		next_commit_ID;	blk64_t			next_log_block, head_block;	int			err;	journal_superblock_t	*sb;	journal_header_t	*tmp;	struct buffer_head	*bh;	unsigned int		sequence;	int			blocktype;	/*	 * First thing is to establish what we expect to find in the log	 * (in terms of transaction IDs), and where (in terms of log	 * block offsets): query the superblock.	 */	sb = journal->j_superblock;	next_commit_ID = ext2fs_be32_to_cpu(sb->s_sequence);	next_log_block = ext2fs_be32_to_cpu(sb->s_start);	head_block = next_log_block;	if (next_log_block == 0)		return 0;	bh = getblk(journal->j_dev, 0, journal->j_blocksize);	if (bh == NULL)		return ENOMEM;	/*	 * Now we walk through the log, transaction by transaction,	 * making sure that each transaction has a commit block in the	 * expected place.  Each complete transaction gets replayed back	 * into the main filesystem.	 */	while (1) {		dbg_printf("Scanning for sequence ID %u at %lu/%lu/n",			  next_commit_ID, (unsigned long)next_log_block,			  journal->j_last);		/* Skip over each chunk of the transaction looking		 * either the next descriptor block or the final commit		 * record. */		err = journal_bmap(journal, next_log_block, &bh->b_blocknr);		if (err)			goto err;		mark_buffer_uptodate(bh, 0);		ll_rw_block(READ, 1, &bh);		err = bh->b_err;		if (err)			goto err;		next_log_block++;		wrap(journal, next_log_block);		/* What kind of buffer is it?		 *		 * If it is a descriptor block, check that it has the		 * expected sequence number.  Otherwise, we're all done		 * here. */		tmp = (journal_header_t *)bh->b_data;		if (tmp->h_magic != ext2fs_cpu_to_be32(JFS_MAGIC_NUMBER)) {			dbg_printf("JBD2: wrong magic 0x%x/n", tmp->h_magic);			goto err;		}		blocktype = ext2fs_be32_to_cpu(tmp->h_blocktype);		sequence = ext2fs_be32_to_cpu(tmp->h_sequence);		dbg_printf("Found magic %d, sequence %d/n",			  blocktype, sequence);		if (sequence != next_commit_ID) {			dbg_printf("JBD2: Wrong sequence %d (wanted %d)/n",				   sequence, next_commit_ID);			goto err;		}		/* OK, we have a valid descriptor block which matches		 * all of the sequence number checks.  What are we going		 * to do with it?  That depends on the pass... */		switch (blocktype) {		case JFS_DESCRIPTOR_BLOCK:			next_log_block += count_tags(journal, bh->b_data);			wrap(journal, next_log_block);			continue;		case JFS_COMMIT_BLOCK:			head_block = next_log_block;			next_commit_ID++;			continue;		case JFS_REVOKE_BLOCK:			continue;		default:			dbg_printf("Unrecognised magic %d, end of scan./n",				  blocktype);//.........这里部分代码省略.........
开发者ID:DebdutBiswas,项目名称:WinFLASHTool,代码行数:101,


示例23: return

List BlockLNLP::get_smap_coefficients(){         return(wrap(smap_coefficients));}
开发者ID:albert3858,项目名称:rEDM,代码行数:4,


示例24: switch

void Forest::simulateInteraction(Actor* actor){    _debugBoxes.clear();    _currentJumper = actor;    Jumper* jumper = dynamic_cast<Jumper*>( actor );    if( !jumper ) return;        	CanopySimulator* canopy = jumper->getDominantCanopy();    _currentCanopy = canopy;    _currentCanopyInfo = canopy->getGearRecord();	_jumperCanopyIsOpened = canopy->isOpened();    if( _jumperCanopyIsOpened )    {        _currentCanopyCollision = CanopySimulator::getCollisionGeometry( canopy->getClump() );        _currentCanopyActor = canopy->getNxActor();    }    else    {        _currentCanopyCollision = NULL;        _currentCanopyActor = NULL;    }    // obtain collision atomic    _currentJumperCollision = NULL;    _currentJumperActor     = NULL;    switch( jumper->getPhase() )    {    case ::jpFreeFalling:        _currentJumperActor = jumper->getFreefallActor();        _currentJumperCollision = Jumper::getCollisionFF( jumper->getClump() );        assert( _currentJumperCollision );        break;    case ::jpFlight:        if( _jumperCanopyIsOpened )        {            _currentJumperActor = jumper->getFlightActor();            _currentJumperCollision = Jumper::getCollisionFC( jumper->getClump() );        }        else        {            _currentJumperActor = jumper->getFreefallActor();            _currentJumperCollision = Jumper::getCollisionFF( jumper->getClump() );        }        assert( _currentJumperCollision );        break;    }    if( _currentJumperCollision )    {        // collide jumper with forest        _jumperOBB = calculateOBB(             _currentJumperCollision->getGeometry(),            _currentJumperCollision->getFrame()->getLTM(),            1.0f        );        _jumperOBB.center = _currentJumperActor->getGlobalPosition();         _debugBoxes.push_back( _jumperOBB );        float testBoxSize = 250;        Vector3f jumperPos = wrap( _jumperOBB.center );        _canopyBatch->forAllInstancesInAABB(            jumperPos - Vector3f( testBoxSize,testBoxSize,testBoxSize ),            jumperPos + Vector3f( testBoxSize,testBoxSize,testBoxSize ),            onCollideJumper,            this        );    }    if( _currentCanopyCollision && !canopy->isCohesionState() )    {        _canopyOBB = calculateOBB(            _currentCanopyCollision->getGeometry(),            _currentCanopyCollision->getFrame()->getLTM(),            1.0f        );        _canopyOBB.center = _currentCanopyActor->getGlobalPosition();        _debugBoxes.push_back( _canopyOBB );        float testBoxSize = 750;        Vector3f canopyPos = wrap( _canopyOBB.center );        _canopyBatch->forAllInstancesInAABB(            canopyPos - Vector3f( testBoxSize,testBoxSize,testBoxSize ),            canopyPos + Vector3f( testBoxSize,testBoxSize,testBoxSize ),            onCollideCanopy,            this        );    }    _currentJumper = NULL;    _currentJumperCollision = NULL;    _currentJumperActor = NULL;    _jumperCanopyIsOpened = false;    _currentCanopyCollision = NULL;    _currentCanopyActor = NULL;}
开发者ID:AndreMeijer86,项目名称:base-pro-edition,代码行数:95,


示例25: toJS

JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, Blob& blob){    return wrap(state, globalObject, blob);}
开发者ID:eocanha,项目名称:webkit,代码行数:4,


示例26: wrap

void CXBMCRenderManager::WaitPresentTime(double presenttime){  double frametime;  int fps = g_VideoReferenceClock.GetRefreshRate(&frametime);  if(fps <= 0)  {    /* smooth video not enabled */    CDVDClock::WaitAbsoluteClock(presenttime * DVD_TIME_BASE);    return;  }  bool ismaster = CDVDClock::IsMasterClock();  //the videoreferenceclock updates its clock on every vertical blank  //we want every frame's presenttime to end up in the middle of two vblanks  //if CDVDPlayerAudio is the master clock, we add a correction to the presenttime  if (ismaster)    presenttime += m_presentcorr * frametime;  double clock     = CDVDClock::WaitAbsoluteClock(presenttime * DVD_TIME_BASE) / DVD_TIME_BASE;  double target    = 0.5;  double error     = ( clock - presenttime ) / frametime - target;  m_presenterr     = error;  // correct error so it targets the closest vblank  error = wrap(error, 0.0 - target, 1.0 - target);  // scale the error used for correction,  // based on how much buffer we have on  // that side of the target  if(error > 0)    error /= 2.0 * (1.0 - target);  if(error < 0)    error /= 2.0 * (0.0 + target);  //save error in the buffer  m_errorindex = (m_errorindex + 1) % ERRORBUFFSIZE;  m_errorbuff[m_errorindex] = error;  //get the average error from the buffer  double avgerror = 0.0;  for (int i = 0; i < ERRORBUFFSIZE; i++)    avgerror += m_errorbuff[i];  avgerror /= ERRORBUFFSIZE;  //if CDVDPlayerAudio is not the master clock, we change the clock speed slightly  //to make every frame's presenttime end up in the middle of two vblanks  if (!ismaster)  {    //integral correction, clamp to -0.5:0.5 range    m_presentcorr = std::max(std::min(m_presentcorr + avgerror * 0.01, 0.1), -0.1);    g_VideoReferenceClock.SetFineAdjust(1.0 - avgerror * 0.01 - m_presentcorr * 0.01);  }  else  {    //integral correction, wrap to -0.5:0.5 range    m_presentcorr = wrap(m_presentcorr + avgerror * 0.01, target - 1.0, target);    g_VideoReferenceClock.SetFineAdjust(1.0);  }  //printf("%f %f % 2.0f%% % f % f/n", presenttime, clock, m_presentcorr * 100, error, error_org);}
开发者ID:Openivo,项目名称:xbmc,代码行数:65,



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


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