/**************************************************************************** * Function : HashKey * Description: This function generates a hash key for a (MAX_UNCODED + 1) * long string located either in the sliding window or the * uncoded lookahead. The key generation algorithm is * supposed to be based on the algorithm used by gzip. As * reported in K. Sadakane, H. Imai. "Improving the Speed of * LZ77 Compression by Hashing and Suffix Sorting". IEICE * Trans. Fundamentals, Vol. E83-A, No. 12 (December 2000) * Parameters : offset - offset into either the uncoded lookahead or the * sliding window. * lookahead - TRUE iff offset is an offset into the uncoded * lookahead buffer. * Effects : NONE * Returned : The sliding window index where the match starts and the * length of the match. If there is no match a length of * zero will be returned. ****************************************************************************/ unsigned int HashKey(unsigned int offset, unsigned char lookahead) { int i, hashKey; hashKey = 0; if (lookahead) { /* string is in the lookahead buffer */ for (i = 0; i < (MAX_UNCODED + 1); i++) { hashKey = (hashKey << 5) ^ (uncodedLookahead[offset]); hashKey %= HASH_SIZE; offset = Wrap((offset + 1), MAX_CODED); } } else { /* string is in the sliding window */ for (i = 0; i < (MAX_UNCODED + 1); i++) { hashKey = (hashKey << 5) ^ (slidingWindow[offset]); hashKey %= HASH_SIZE; offset = Wrap((offset + 1), WINDOW_SIZE); } } return hashKey; }
void CScrolledTextBox::SetValue(const wxString& s) { int lineHeight, totalLines, totalWidth, usableWidth; wxString t = s; // Delete sizer & its children (CTransparentStaticText objects) m_TextSizer->Clear(true); // Change all occurrences of "<sup>n</sup>" to "^n" t.Replace(wxT("<sup>"), wxT("^"), true); t.Replace(wxT("</sup>"), wxT(""), true); t.Replace(wxT("<"), wxT("<"), true); // First see if it fits without vertical scroll bar totalWidth = GetSize().GetWidth(); totalLines = Wrap(t, totalWidth, &lineHeight); m_TextSizer->FitInside(this); usableWidth = GetClientSize().GetWidth(); if (usableWidth < totalWidth) { // It has a vertical scroll bar, so wrap again for reduced width m_TextSizer->Clear(true); totalLines = Wrap(t, usableWidth - SCROLLBARSPACER, &lineHeight); m_TextSizer->FitInside(this); } SetScrollRate(1, lineHeight); }
void CEmblFormatter::FormatDate (const CDateItem& date, IFlatTextOStream& text_os) { string date_str; list<string> l; x_AddXX(text_os); // Create Date const CDate* dp = date.GetCreateDate(); if ( dp != 0 ) { DateToString(*dp, date_str); } if ( date_str.empty() ) { date_str = "01-JAN-1900"; } Wrap(l, "DT", date_str); // Update Date dp = date.GetUpdateDate(); if ( dp != 0 ) { date_str.erase(); DateToString(*dp, date_str); } Wrap(l, "DT", date_str); text_os.AddParagraph(l); }
/*************************************************************************** * Function : ComparePresorted * Description: This comparison function is designed for use with qsort * and "block", a global array of "blockSize" unsigned chars. * It compares two strings in "block" starting at indices * s1 and s2 and ending at indices s1 - 1 and s2 - 1. * The strings are assumed to be presorted so that first two * characters are known to be matching. * Parameters : s1 - The starting index of a string in block * s2 - The starting index of a string in block * Effects : NONE * Returned : > 0 if string s1 > string s2 * 0 if string s1 == string s2 * < 0 if string s1 < string s2 ***************************************************************************/ int ComparePresorted(const void *s1, const void *s2) { int offset1, offset2; int i; int result; offset1 = *((int *)s1); offset2 = *((int *)s2); /*********************************************************************** * Compare 1 character at a time until there's difference or the end of * the block is reached. Since we're only sorting strings that already * match at the first two characters, start with the third character. ***********************************************************************/ for(i = 2; i < blockSize; i++) { result = (int)block[Wrap((offset1 + i), blockSize)] - (int)block[Wrap((offset2 + i), blockSize)]; if (result != 0) { return result; } } /* strings are identical */ return 0; }
void CScrolledTextBox::SetValue(const wxString& s) { int lineHeight, totalLines, totalWidth; wxString t = s; // Delete sizer & its children (CTransparentStaticText objects) m_TextSizer->Clear(true); // Change all occurrences of "<sup>n</sup>" to "^n" t.Replace(wxT("<sup>"), wxT("^"), true); t.Replace(wxT("</sup>"), wxT(""), true); t.Replace(wxT("<"), wxT("<"), true); // First see if it fits without vertical scroll bar totalWidth = GetSize().GetWidth(); totalLines = Wrap(t, totalWidth, &lineHeight); m_TextSizer->FitInside(this); SetScrollRate(1, lineHeight); int scrollLines = GetScrollLines(wxVERTICAL); // Returns 0 if no scrollbar if (scrollLines > 0) { int sbwidth = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); // It has a vertical scroll bar, so wrap again for reduced width m_TextSizer->Clear(true); totalLines = Wrap(t, totalWidth - sbwidth - SCROLLBARSPACER, &lineHeight); m_TextSizer->FitInside(this); } }
/**************************************************************************** * Function : ReplaceChar * Description: This function replaces the character stored in * slidingWindow[charIndex] with the one specified by * replacement. The hash table entries effected by the * replacement are also corrected. * Parameters : charIndex - sliding window index of the character to be * removed from the linked list. * Effects : slidingWindow[charIndex] is replaced by replacement. Old * hash entries for strings containing slidingWindow[charIndex] * are removed and new ones are added. * Returned : NONE ****************************************************************************/ void ReplaceChar(unsigned int charIndex, unsigned char replacement) { unsigned int firstIndex, i; if (charIndex < MAX_UNCODED) { firstIndex = (WINDOW_SIZE + charIndex) - MAX_UNCODED; } else { firstIndex = charIndex - MAX_UNCODED; } /* remove all hash entries containing character at char index */ for (i = 0; i < (MAX_UNCODED + 1); i++) { RemoveString(Wrap((firstIndex + i), WINDOW_SIZE)); } slidingWindow[charIndex] = replacement; /* add all hash entries containing character at char index */ for (i = 0; i < (MAX_UNCODED + 1); i++) { AddString(Wrap((firstIndex + i), WINDOW_SIZE)); } }
Application::Application(QWidget *parent) : QWidget(parent), demonstration( new Demonstration(this)), authors(new Authors(this)), main_menu(new MainMenu(this)), theory(new Theory(this)), demonstration_wrapper(Wrap(demonstration, false, false)), authors_wrapper(Wrap(authors)), main_menu_wrapper(Wrap(main_menu)), theory_wrapper(Wrap(theory, true, false)) { setFont(QFont("Times", 16, QFont::Normal)); setPalette(demonstration->palette()); widgets.addWidget(main_menu_wrapper); widgets.addWidget(demonstration_wrapper); widgets.addWidget(theory_wrapper); widgets.addWidget(authors_wrapper); QVBoxLayout * layout = new QVBoxLayout; layout->addWidget(&widgets); setLayout(layout); }
int main() { #ifdef USE_ITERATOR process(Wrap(a), Wrap(a + length)); #else process(a, a + length); #endif }
/**************************************************************************** * Function : FindMatch * Description: This function will search through the slidingWindow * dictionary for the longest sequence matching the MAX_CODED * long string stored in uncodedLookahed. * Parameters : windowHead - head of sliding window * uncodedHead - head of uncoded lookahead buffer * Effects : None * Returned : The sliding window index where the match starts and the * length of the match. If there is no match a length of * zero will be returned. ****************************************************************************/ encoded_string_t FindMatch(const unsigned int windowHead, unsigned int uncodedHead) { encoded_string_t matchData; unsigned int i; unsigned int j; matchData.length = 0; matchData.offset = 0; i = windowHead; /* start at the beginning of the sliding window */ j = 0; int count = 0; while (1) { if (slidingWindow[i] == uncodedLookahead[uncodedHead]) { /* we matched one. how many more match? */ j = 1; while(slidingWindow[Wrap((i + j), WINDOW_SIZE)] == uncodedLookahead[Wrap((uncodedHead + j), MAX_CODED)]) { if (j >= MAX_CODED) { break; } j++; } if (j > matchData.length) { matchData.length = j; matchData.offset = i; } } if (j >= MAX_CODED) { matchData.length = MAX_CODED; break; } i = Wrap((i + 1), WINDOW_SIZE); if (i == windowHead) { /* we wrapped around */ break; } } return matchData; }
Bool AnimCurInit (ScreenPtr pScreen) { AnimCurScreenPtr as; if (AnimCurGeneration != serverGeneration) { int i; AnimCurGeneration = serverGeneration; for (i = 0; i < MAXDEVICES; i++) { animCurState[i].pCursor = 0; animCurState[i].pScreen = 0; animCurState[i].elt = 0; animCurState[i].time = 0; } } as = (AnimCurScreenPtr) xalloc (sizeof (AnimCurScreenRec)); if (!as) return FALSE; Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen); Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits); Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor); Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor); Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor); SetAnimCurScreen(pScreen,as); return TRUE; }
Bool AnimCurInit (ScreenPtr pScreen) { AnimCurScreenPtr as; if (AnimCurGeneration != serverGeneration) { AnimCurScreenPrivateIndex = AllocateScreenPrivateIndex (); if (AnimCurScreenPrivateIndex < 0) return FALSE; AnimCurGeneration = serverGeneration; animCurState.pCursor = 0; animCurState.pScreen = 0; animCurState.elt = 0; animCurState.time = 0; } as = (AnimCurScreenPtr) xalloc (sizeof (AnimCurScreenRec)); if (!as) return FALSE; Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen); Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits); Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor); Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); Wrap(as, pScreen, RealizeCursor, AnimCurRealizeCursor); Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor); Wrap(as, pScreen, RecolorCursor, AnimCurRecolorCursor); SetAnimCurScreen(pScreen,as); return TRUE; }
void CEmblFormatter::FormatLocus (const CLocusItem& locus, IFlatTextOStream& text_os) { static string embl_mol [14] = { "xxx", "DNA", "RNA", "RNA", "RNA", "RNA", "RNA", "RNA", "AA ", "DNA", "DNA", "RNA", "RNA", "RNA" }; const CBioseqContext& ctx = *locus.GetContext(); list<string> l; CNcbiOstrstream id_line; string hup = ctx.IsHup() ? " confidential" : " standard"; string topology = (locus.GetTopology() == CSeq_inst::eTopology_circular) ? "circular" : kEmptyStr; const string& mol = ctx.Config().UseEmblMolType() ? s_EmblMol[locus.GetBiomol()] : s_GenbankMol[locus.GetBiomol()]; id_line.setf(IOS_BASE::left, IOS_BASE::adjustfield); id_line << setw(9) << locus.GetName() << hup << "; " << topology << mol << "; " << locus.GetDivision() << "; " << locus.GetLength() << " BP."; Wrap(l, GetWidth(), "ID", CNcbiOstrstreamToString(id_line)); text_os.AddParagraph(l); }
U0 DrawIt(CTask *,CDC *dc) { F64 dt=tMBeat-t0,a_x,a_y; if (dt<8) { a_y=ã/2; a_x=Wrap(ã*dt/4,0); } else if (dt<32) {
static Bool AnimCurDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap (as, pScreen, DisplayCursor); if (IsAnimCur(pCursor)) { if (pCursor != animCurState.pCursor) { AnimCurPtr ac = GetAnimCur(pCursor); ret = (*pScreen->DisplayCursor) (pScreen, ac->elts[0].pCursor); if (ret) { animCurState.elt = 0; animCurState.time = GetTimeInMillis () + ac->elts[0].delay; animCurState.pCursor = pCursor; animCurState.pScreen = pScreen; } } else ret = TRUE; } else { animCurState.pCursor = 0; animCurState.pScreen = 0; ret = (*pScreen->DisplayCursor) (pScreen, pCursor); } Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor); return ret; }
void Scene::Insert(Interactor* component, IntCoord x, IntCoord y, Alignment a) { Interactor* i = Wrap(component); PrepareToInsert(i); IntCoord ax = x, ay = y; DoAlign(i, a, ax, ay); DoInsert(i, true, ax, ay); }
wxCoord ClueListBox::OnMeasureItem(size_t n) const { XPuzzle::Clue clue = GetItem(n); // Cache the wrapped clue's text if it isn't already if (m_cachedClues.at(n).empty()) { int maxWidth; GetClientSize(&maxWidth, NULL); m_cachedClues.at(n) = Wrap(this, clue.Text(), maxWidth - m_numWidth - GetMargins().x); } int height = 0; const wxArrayString lines = wxStringTokenize(m_cachedClues.at(n), _T("\n")); for (wxArrayString::const_iterator it = lines.begin(); it != lines.end(); ++it) { int lineHeight; GetTextExtent(*it, NULL, &lineHeight); height += lineHeight; } return height; }
static void AnimCurScreenBlockHandler (int screenNum, pointer blockData, pointer pTimeout, pointer pReadmask) { ScreenPtr pScreen = screenInfo.screens[screenNum]; AnimCurScreenPtr as = GetAnimCurScreen(pScreen); DeviceIntPtr dev; Bool activeDevice = FALSE; CARD32 now = 0, soonest = ~0; /* earliest time to wakeup again */ for (dev = inputInfo.devices; dev; dev = dev->next) { if (IsPointerDevice(dev) && pScreen == dev->spriteInfo->anim.pScreen) { if (!activeDevice) { now = GetTimeInMillis (); activeDevice = TRUE; } if ((INT32) (now - dev->spriteInfo->anim.time) >= 0) { AnimCurPtr ac = GetAnimCur(dev->spriteInfo->anim.pCursor); int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt; DisplayCursorProcPtr DisplayCursor; /* * Not a simple Unwrap/Wrap as this * isn't called along the DisplayCursor * wrapper chain. */ DisplayCursor = pScreen->DisplayCursor; pScreen->DisplayCursor = as->DisplayCursor; (void) (*pScreen->DisplayCursor) (dev, pScreen, ac->elts[elt].pCursor); as->DisplayCursor = pScreen->DisplayCursor; pScreen->DisplayCursor = DisplayCursor; dev->spriteInfo->anim.elt = elt; dev->spriteInfo->anim.time = now + ac->elts[elt].delay; } if (soonest > dev->spriteInfo->anim.time) soonest = dev->spriteInfo->anim.time; } } if (activeDevice) AdjustWaitForDelay (pTimeout, soonest - now); Unwrap (as, pScreen, BlockHandler); (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask); if (activeDevice) Wrap (as, pScreen, BlockHandler, AnimCurScreenBlockHandler); else as->BlockHandler = NULL; }
Font::Font(std::string _fontName) : m_texture("texture/"+_fontName+".png"), m_effect( "shader/font.vs", "shader/font.ps", "shader/font.gs") { m_effect.SetRasterizerState(RasterizerState(RasterizerState::CULL_MODE::NONE, RasterizerState::FILL_MODE::SOLID)); m_effect.SetBlendState(BlendState(BlendState::BLEND_OPERATION::ADD, BlendState::BLEND::SRC_ALPHA, BlendState::BLEND::INV_SRC_ALPHA)); m_effect.SetDepthStencilState(DepthStencilState(DepthStencilState::COMPARISON_FUNC::ALWAYS, false)); m_effect.BindTexture( "u_characterTex", 7, Graphic::Resources::GetSamplerState(SamplerStates::LINEAR) ); m_effect.BindUniformBuffer( Graphic::Resources::GetUBO(UniformBuffers::GLOBAL) ); Jo::Files::HDDFile file("texture/"+_fontName+".sraw"); Jo::Files::MetaFileWrapper Wrap( file, Jo::Files::Format::SRAW ); auto& PosX = Wrap.RootNode[std::string("positionX")]; auto& PosY = Wrap.RootNode[std::string("positionY")]; auto& sizeX = Wrap.RootNode[std::string("sizeX")]; auto& sizeY = Wrap.RootNode[std::string("sizeY")]; //get values for(int i = 0; i < 256; i++) { m_sizeTable[i] = Vec2(sizeX[i],sizeY[i]); // Half pixel offset necessary - otherwise rounding errors in shader m_coordTable[i] = Vec2(float(PosX[i]) + 0.5f/m_texture.Width(),PosY[i]); // m_sizeTable[i] = Vec2(1-0.01f*i,i*0.01f);//0.1; 0.25 // m_coordTable[i] = Vec2(0.f,0.25f); } }
int Shot::Update() { // shots die after a fixed amount of time if (timeToDie > 0) { origin = TPoint(origin.x+mx,origin.y+my); timeToDie--; if (timeToDie==0) condemned = true; } Wrap(); // if the shot is off the screen, wrap to other side // check against all meteors in the list, to see if any are // colliding with ourself Sprite* meteor = owner->CheckForHitMeteor( origin ); // if so, tell the meteor it was hit, and mark ourself for // deletion if (meteor) { ((Meteor*)meteor)->Hit(); condemned = true; int size = ((Meteor*)meteor)->GetSize(); switch (size) { case 0: return 500; case 1: return 50; case 2: return 5; } } return 0; }
/*! 文字列を返す関数を処理する PPAから呼びだされる @date 2003.02.24 Moca CallHandleFunction対応 */ void __stdcall CPPA::stdStrFunc( const char* FuncName, const int Index, const char* Argument[], const int ArgSize, int* Err_CD, char** ResultValue) { NEVER_USED_PARAM(FuncName); VARIANT Ret; ::VariantInit(&Ret); *Err_CD = 0; if( false != CallHandleFunction(Index, Argument, ArgSize, &Ret) ){ if(VT_BSTR == Ret.vt){ int len; char* buf; Wrap(&Ret.bstrVal)->Get(&buf,&len); m_CurInstance->m_cMemRet.SetString(buf,len); // Mar. 9, 2003 genta delete[] buf; *ResultValue = m_CurInstance->m_cMemRet.GetStringPtr(); ::VariantClear(&Ret); return; } } ::VariantClear(&Ret); *Err_CD = Index + 1; *ResultValue = const_cast<char*>(""); return; }
static PyObject* Wrap(PyObject* cap, bool owned){ if (!Check(cap)) { if (PyList_Check(cap)) { Py_ssize_t N = PyList_GET_SIZE(cap); PyObject* result = PyList_New(N); for (Py_ssize_t i = 0; i < N; i++) { PyObject* item = PyList_GET_ITEM(cap, i); PyObject* out = Wrap(item, false); if (!out) { Py_DECREF(result); return NULL; } PyList_SET_ITEM(result, i, out); } return result; } else { Py_INCREF(cap); return cap; } } return WrapCore(cap, owned); }
EntityJS:: EntityJS( v8::Local<v8::Object> object, const char* mesh ) { // this-> object = object ; parent = NULL ; entity = OgreManager:: getSingletonPtr()-> m_pSceneMgr-> createEntity( mesh ) ; // int subEntityCount = entity-> getNumSubEntities() ; Ogre:: SubEntity* nextSubEntity ; v8::Handle<v8::Value> nextSubEntityObject ; v8::Handle<v8::Array> subEntitySet = v8::Array::New( subEntityCount ) ; for( int i = 0 ; i < subEntityCount ; i++ ) { nextSubEntity = entity-> getSubEntity( i ) ; nextSubEntityObject = SubEntityJS:: NewFromSubEntity( nextSubEntity ) ; subEntitySet-> Set( i, nextSubEntityObject ) ; } object-> Set( v8::String::New( "subEntitySet" ), subEntitySet ) ; v8::Handle<v8::Object> animationStateSetObject = v8::Object::New() ; Ogre:: AnimationStateSet* animationStateSet = entity-> getAllAnimationStates() ; if( animationStateSet ) { Ogre:: AnimationStateIterator animationStateIterator = animationStateSet-> getAnimationStateIterator() ; printf( "EntityJS:: EntityJS( ... ) at getAllAnimationStates \n" ) ; Ogre:: AnimationState* nextAnimationState ; while( animationStateIterator.hasMoreElements() ) { nextAnimationState = animationStateIterator.getNext() ; printf( "%s \n", nextAnimationState-> getAnimationName().c_str() ) ; animationStateSetObject-> Set( v8::String::New( nextAnimationState-> getAnimationName().c_str() ), AnimationStateJS:: NewFromAnimationStatePtr( nextAnimationState ) ) ; } printf( "EntityJS:: EntityJS( ... ) at object, set animationStateSet \n" ) ; object-> Set( v8::String::New( "animationStateSet" ), animationStateSetObject ) ; } Wrap( object ) ; MemoryManagerJS:: singleton-> updateV8AllocatedMemory() ; }
/**************************************************************************** * Function : FindMatch * Description: This function will search through the slidingWindow * dictionary for the longest sequence matching the MAX_CODED * long string stored in uncodedLookahead. * Parameters : uncodedHead - head of uncoded lookahead buffer * Effects : NONE * Returned : The sliding window index where the match starts and the * length of the match. If there is no match a length of * zero will be returned. ****************************************************************************/ encoded_string_t FindMatch(unsigned int windowHead, unsigned int uncodedHead) { encoded_string_t matchData; unsigned int i, j; matchData.length = 0; matchData.offset = 0; i = hashTable[HashKey(uncodedHead, TRUE)]; /* start of proper list */ j = 0; while (i != NULL_INDEX) { if (slidingWindow[i] == uncodedLookahead[uncodedHead]) { /* we matched one how many more match? */ j = 1; while(slidingWindow[Wrap((i + j), WINDOW_SIZE)] == uncodedLookahead[Wrap((uncodedHead + j), MAX_CODED)]) { if (j >= MAX_CODED) { break; } j++; } if (j > matchData.length) { matchData.length = j; matchData.offset = i; } } if (j >= MAX_CODED) { matchData.length = MAX_CODED; break; } i = next[i]; /* try next in list */ } return matchData; }
v8Sprite::v8Sprite(Handle<Object> wrapper) : sprite(NULL) { if (NULL == this->sprite) { this->sprite = Sprite::factoryManager.instance()->create(); } Wrap(wrapper); }
USING_WORKERS_NAMESPACE // static XMLHttpRequestUpload* XMLHttpRequestUpload::Create(JSContext* aCx, XMLHttpRequest* aXHR) { nsRefPtr<XMLHttpRequestUpload> upload = new XMLHttpRequestUpload(aCx, aXHR); return Wrap(aCx, NULL, upload) ? upload : NULL; }
static Bool AnimCurSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; Unwrap(as, pScreen, SetCursorPosition); if (pDev->spriteInfo->anim.pCursor) { pDev->spriteInfo->anim.pScreen = pScreen; if (!as->BlockHandler) Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); } ret = (*pScreen->SetCursorPosition) (pDev, pScreen, x, y, generateEvent); Wrap(as, pScreen, SetCursorPosition, AnimCurSetCursorPosition); return ret; }
static Bool AnimCurDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { AnimCurScreenPtr as = GetAnimCurScreen(pScreen); Bool ret; if (IsFloating(pDev)) return FALSE; Unwrap (as, pScreen, DisplayCursor); if (IsAnimCur(pCursor)) { if (pCursor != pDev->spriteInfo->anim.pCursor) { AnimCurPtr ac = GetAnimCur(pCursor); ret = (*pScreen->DisplayCursor) (pDev, pScreen, ac->elts[0].pCursor); if (ret) { pDev->spriteInfo->anim.elt = 0; pDev->spriteInfo->anim.time = GetTimeInMillis () + ac->elts[0].delay; pDev->spriteInfo->anim.pCursor = pCursor; pDev->spriteInfo->anim.pScreen = pScreen; if (!as->BlockHandler) Wrap(as, pScreen, BlockHandler, AnimCurScreenBlockHandler); } } else ret = TRUE; } else { pDev->spriteInfo->anim.pCursor = 0; pDev->spriteInfo->anim.pScreen = 0; ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor); } Wrap (as, pScreen, DisplayCursor, AnimCurDisplayCursor); return ret; }
static LispObjectPtr lisp_StepSaw(LispInterpreter *L, LispObjectPtr args, LispObjectPtr env, void *data) { auto self = L->Car(args); auto outKey = L->SymbolRef("out"); double out = L->NumVal(GetSlot(L, self, outKey)); out = Wrap(0.0, 1.0, out + L->NumVal(GetSlot(L, self, L->SymbolRef("freq")))); auto outNum = L->MakeNumber(out); PutSlot(L, self, outKey, outNum); return outNum; }
Image_v8::Image_v8(Handle<Object> wrapper, Image *image) : image(image) , owns(false) { Wrap(wrapper); if (NULL == this->image) { this->image = Image::factory->create(); owns = true; } }
Fence::Fence(const FunctionCallbackInfo<Value>& args) { Isolate* isolate = args.GetIsolate(); HandleScope handle_scope(isolate); Wrap(args.This()); device.Reset(isolate, args[0]->ToObject()); fence = double_to_ptr<VkFence>(args[1]->NumberValue()); setELitPtr(args.This(), fence, fence); }