void ResourceDictionary::EmitChanged (CollectionChangedAction action, Value *new_value, Value *old_value, const char *key) { #if EVENT_ARG_REUSE if (!HasHandlers (ResourceDictionary::ChangedEvent)) return; if (!changedEventArgs) changedEventArgs = MoonUnmanagedFactory::CreateResourceDictionaryChangedEventArgs (); changedEventArgs->SetChangedAction (action); changedEventArgs->SetNewItem (new_value); changedEventArgs->SetOldItem (old_value); changedEventArgs->SetKey (key); changedEventArgs->ref (); Emit (ResourceDictionary::ChangedEvent, changedEventArgs); changedEventArgs->SetNewItem (NULL); changedEventArgs->SetOldItem (NULL); changedEventArgs->SetKey (NULL); #else if (HasHandlers (ResourceDictionary::ChangedEvent)) Emit (ResourceDictionary::ChangedEvent, new ResourceDictionaryChangedEventArgs (action, new_value, old_value, key)); #endif }
void dec_DynamicSet(u32 regbase,u32 offs=0) { if (offs==0) Emit(shop_jdyn,reg_pc_dyn,mk_reg((Sh4RegType)regbase)); else Emit(shop_jdyn,reg_pc_dyn,mk_reg((Sh4RegType)regbase),mk_imm(offs)); }
// From FigEdit. ushort DskBlkRd(ushort page) { // SerialFlashReadBlock(ushort block, byte *dest); ushort next=0; next=VDskFind(VDskEmptyBlk,gVideoBuff); ushort phys=-2; phys=VDskRead(page,gVideoBuff); if(phys==next) Cls(); // return an empty screen if it was an empty block. PrintAt(1,20+1); DotHex(page); Emit('@'); DotHex(phys); Emit('!'); DotHex(next); #if _DEBUGFLASHID__ PrintAt(0,kMaxEditHeight+2); DotHex(VDskBaseBlock()); Emit(' '); DotHex(SerialFlashID()); Emit('!'); DotHex(next); #endif return next; }
void HttpRequest::Write (gint64 offset, void *buffer, gint32 length) { gint64 reported_offset = offset; VERIFY_MAIN_THREAD; LOG_DOWNLOADER ("HttpRequest::Write (%" G_GINT64_FORMAT ", %p, %i) HasHandlers: %i\n", offset, buffer, length, HasHandlers (WriteEvent)); written_size += length; /* write to tmp file */ if (tmpfile_fd != -1) { if (offset != -1 && lseek (tmpfile_fd, offset, SEEK_SET) == -1) { printf ("Moonlight: error while seeking to %" G_GINT64_FORMAT " in temporary file '%s': %s\n", offset, tmpfile, strerror (errno)); } else if (write (tmpfile_fd, buffer, length) != length) { printf ("Moonlight: error while writing to temporary file '%s': %s\n", tmpfile, strerror (errno)); } } if (HasHandlers (WriteEvent)) { if (reported_offset == -1 && ((options & CustomHeaders) == 0)) { /* We check if custom headers is required, if so, our creator might have issued a byte range request, * in which case written_size isn't related to offset */ reported_offset = written_size - length; } Emit (WriteEvent, new HttpRequestWriteEventArgs (buffer, reported_offset, length)); } if (notified_size > 0 && HasHandlers (ProgressChangedEvent)) Emit (ProgressChangedEvent, new HttpRequestProgressChangedEventArgs (((double) offset + (double) length) / (double) notified_size)); }
static void EmitCharSet(ParseInfo *info, AReOpcode *set, WideCharSet *wset, ABool complement, int flags) { int i; int len; len = A_SET_SIZE + 2 + WideSetLen(wset) * 2; while (info->bufInd + len > info->bufLen) { if (!GrowOutputBuffer(info)) return; } if (complement) { for (i = 0; i < A_SET_SIZE; i++) info->buf[info->bufInd++] = set[i] ^ 0xffff; } else { for (i = 0; i < A_SET_SIZE; i++) info->buf[info->bufInd++] = set[i]; } Emit(info, WideSetLen(wset)); Emit(info, flags | ((info->flags & A_RE_NOCASE) ? A_WS_IGNORE_CASE : 0) | (complement ? A_WS_COMPLEMENT : 0)); for (i = 0; i < WideSetLen(wset); i++) { Emit(info, WideSetLo(wset, i)); Emit(info, WideSetHi(wset, i)); } }
View::View() : Subject() , MouseEventsDispatcher() , KeyboardEventsDispatcher() , camera_() , lights_manager_() , view_settings_() , selection_set_() , view_adapter_(nullptr) , model_(nullptr) , operator_(nullptr) { try { view_adapter_.reset(new OpenGLViewAdapter(*this)); } catch(CustomExp e) { throw e; } // Inform observers to set default width and height Emit(ViewEvent::WINDOW_RESIZE, WindowResizeInfo(800, 600)); // Inform observers to apply all viewer settings Emit(ViewEvent::VIEWER_SETTINGS_CHANGE); }
void RegExpMacroAssemblerIrregexp::CheckCharacter(uint32_t c, Label* on_equal) { if (c > MAX_FIRST_ARG) { Emit(BC_CHECK_4_CHARS, 0); Emit32(c); } else { Emit(BC_CHECK_CHAR, c); } EmitOrLink(on_equal); }
int PrintUsage(bool bFull) { Emit(IDS_SDL_USAGE); if (bFull != false) { Emit(IDS_SDL_USAGE_EX); } return 1; }
int main(int argc, char* argv[]) { LPTSTR szInputFile = NULL; LPTSTR szOutputFile = NULL; LPTSTR szQueryString = NULL; LPTSTR szFormInput = NULL; LPTSTR szErrorLog = NULL; LPTSTR szContentType = NULL; LPTSTR szVerb = NULL; BOOL bNoLogo = FALSE; HINSTANCE hInstResource=LoadLocResDll(szClStencilUIDll,TRUE); _AtlBaseModule.AddResourceInstance(hInstResource); if (argc < 3) { CStringA str; Emit(str, IDS_INVALID_ARGS); PrintUsage(str); return 1; } CoInitialize(NULL); if (!GetParameters(argc, argv, &szInputFile, &szOutputFile, &szQueryString, &szFormInput, &szErrorLog, &szContentType, &szVerb, &bNoLogo)) { return 1; } CStringA strHeader; if (bNoLogo == FALSE) { Emit(strHeader, IDS_HEADER); printf((LPCSTR) strHeader); } _Module.Init(NULL, GetModuleHandle(NULL)); CSProcExtension extension; if (!extension.Initialize()) { CStringA str; Emit(str, IDS_INIT_FAILED); printf((LPCSTR) str); _Module.Term(); return 1; } if (!extension.DispatchStencilCall(szInputFile, szOutputFile, szQueryString, szErrorLog, szFormInput, szContentType, szVerb)) printf("%s\n", (LPCSTR) extension.m_strErr); extension.Uninitialize(); _Module.Term(); CoUninitialize(); return 0; }
// [C] const Register& CodeEmitter::Call( const Type& outy, const Operand& callee, const Operand& arg1) { auto& v1 = module_.NewValues(); Emit(*new(zone()) ValuesI(ValuesType::Intern(arg1.type()), v1, arg1)); auto& out = NewRegister(); Emit(*new(zone()) CallI(outy, out, callee, v1)); return out; }
void TestForth(void) { Cls(); ForthCopyBootStrap(); Emit('T'); Emit('F'); //KeyHeart(); //ForthDumpVars(); // @TODO, we can't show the results yet. //ForthDumpVars(); }
void ManualTimeSource::SetCurrentTime (TimeSpan current_time) { this->current_time = current_time; #if PAL_GTK_WINDOWING g_main_context_iteration (g_main_context_default (), false); #endif Emit (TimeSource::TickEvent); Emit (TimeSource::TickEvent); Emit (TimeSource::TickEvent); }
////////////////////////////////////////////////////////////////////////// // // Class ReadStmt // void ReadStmt::Gen( int b, int a, bool bASM ) { if ( bASM ) GenMovLineno( m_lineno ); Expr* pExpr = m_pExpr->Gen(); Temp temp( m_pExpr->m_pType ); Emit( temp.ToString() + " = " + pExpr->ToString() ); Emit( "read " + temp.ToString() ); delete pExpr; }
void BitmapImage::PixmapComplete () { MoonPixbuf *pixbuf; SetProgress (1.0); if (!loader) { if (!moon_error) moon_error = new MoonError (MoonError::EXCEPTION, 4001, "no loader"); goto failed; } loader->Close (moon_error == NULL ? &moon_error : NULL); if (moon_error) goto failed; if (!(pixbuf = loader->GetPixbuf ())) { moon_error = new MoonError (MoonError::EXCEPTION, 4001, "failed to create image data"); goto failed; } SetPixelWidth (pixbuf->GetWidth ()); SetPixelHeight (pixbuf->GetHeight ()); // PixelFormat has been dropped and only Pbgra32 is supported // http://blogs.msdn.com/silverlight_sdk/archive/2009/07/01/breaking-changes-document-errata-silverlight-3.aspx // not clear if '3' channel is still supported (converted to 4) in SL3 if (pixbuf->GetNumChannels () == 4) { SetBitmapData (premultiply_rgba (pixbuf), true); } else { SetBitmapData (expand_rgb_to_argb (pixbuf), true); } Invalidate (); delete loader; loader = NULL; if (HasHandlers (ImageOpenedEvent)) Emit (ImageOpenedEvent, new RoutedEventArgs ()); return; failed: ImageErrorEventArgs *args = NULL; if (HasHandlers (ImageFailedEvent)) args = new ImageErrorEventArgs (*moon_error); CleanupLoader (); if (args) Emit (ImageFailedEvent, args); }
void PrintUsage(LPCSTR lpszErrorText) { CStringA strBuffer; if (lpszErrorText && *lpszErrorText) { Emit(strBuffer, IDS_ERROR, lpszErrorText); printf((LPCSTR) strBuffer); } Emit(strBuffer, IDS_USAGE); printf((LPCSTR) strBuffer); }
/* Parse a parenthised expression, optionally followed by a repetition specifier. */ static void ParseParen(ParseInfo *info) { int oldBufInd; int oldMustStr; int oldMustStrBack; int groupNum; int oldMinLen; int oldMaxLen; oldBufInd = info->bufInd; oldMustStr = info->mustStr; oldMustStrBack = info->mustStrBack; oldMinLen = info->minLen; oldMaxLen = info->maxLen; /* Initialize only to satisfy stupid C compilers. */ groupNum = 0; /* Skip '('. */ info->str++; /* Check end of expression. */ if (info->str == info->strEnd) { AGenerateError(info, ErrUnmatchedLparen); return; } groupNum = info->numParen++; Emit(info, A_LPAREN); Emit(info, groupNum); /* Parse the expression inside parentheses. */ ParseAlternatives(info); Emit(info, A_RPAREN); Emit(info, groupNum); if (groupNum < 10) info->parenFlags |= 1 << groupNum; /* Unexpected end of expression? */ if (info->str == info->strEnd || *info->str != ')') AGenerateError(info, ErrUnmatchedLparen); else { /* Skip ')'. */ info->str++; } ParseRepetition(info, oldMinLen, oldMaxLen, info->bufInd - oldBufInd, oldMustStr, oldMustStrBack); }
void ToolCodeGen::EmitR(ToolCodeSnip *snip) { sInt i; sInt out,in; if(!(snip->Flags & TCS_GENERATED)) { snip->Flags |= TCS_GENERATED; if(snip->Flags & TCS_ADD) { for(i=0;i<snip->InputCount;i++) { EmitR(snip->Inputs[i]); if(i>0) Emit(snip); } } else { for(i=0;i<snip->InputCount;i++) EmitR(snip->Inputs[i]); Emit(snip); } } out = TCG_DISCARD; if(snip->Flags & TCS_LOAD) { if(snip->OutputCID==sCID_GENSCENE || snip->OutputCID==sCID_GENFXCHAIN) out = TCG_POINTER; else out = TCG_KEEP; } for(i=0;i<snip->OutputCount;i++) { if(snip->Outputs[i]->CodeObject && snip->Outputs[i]->CodeObject->GetClass()==sCID_TOOL_PAGEOP) { in = ((PageOp *)snip->Outputs[i]->CodeObject)->Class->InputFlags; if((in&0xf0) && snip->Outputs[i]->Inputs[0]!=snip) in = in>>4; in = in&15; if(in==SCFU_MOD && out==TCG_KEEP) Emit(" Copy();\n"); if(in==SCFU_MOD && out==TCG_POINTER) { Emit("// error here\n"); Error = 1; } } }
void ForthCopyBootStrap(void) { ushort labels[4]; // only allowed 4 labels. ushort dst=0; byte *src=(byte *)gTestProg; DotQuote("FB"); KeyHeart(); do { byte b=GetPgmByte(*src); src++; switch(b) { case kFigLblDef: b=GetPgmByte(*src); // get label value. src++; // next byte. labels[b]=dst; // save. break; case kFigLblFRef: { ushort ref; Emit('.'); // label! b=GetPgmByte(*src); // get offset value. src++; // next byte. ref=0x8000+dst+2+(char)b; // sign extend. DotHex(ref); SramAbsWr(dst++,(byte)(ref>>8)); // big-endian. SramAbsWr(dst++,(byte)(ref&255)); // low-byte. } break; case kFigLblRef: b=GetPgmByte(*src); // get label value. src++; // next byte. SramAbsWr(dst++,(byte)(labels[b]>>8)); // big-endian. SramAbsWr(dst++,(byte)(labels[b]&255)); // low-byte. case kFigLitWord: SramAbsWr(dst++,GetPgmByte(*src++)); // big-endian. SramAbsWr(dst++,GetPgmByte(*src++)); // low-byte. break; default: SramAbsWr(dst++, b); break; } }while(src<&gTestProgEnd); Emit(kKeyEnter); // cr. Emit('a'); dst=0; src=(byte *)gTestProg; do { Dot(SramAbsRd(dst++)); src++; }while(src<&gTestProgEnd); KeyHeart(); Cls(); }
const Register& CodeEmitter::NewArray( const Type& elemty, int const num_elems) { ASSERT(num_elems >= 0); auto& args = module_.NewValues(); auto& args_inst = *new(zone()) ValuesI(ValuesType::Intern(*Ty_Int32), args); args_inst.AppendOperand(NewLiteral(*Ty_Int32, num_elems)); Emit(args_inst); auto& arrty = ArrayType::Intern(elemty, 1); auto& out = NewRegister(); Emit(*new(zone()) NewArrayI(arrty, out, args)); return out; }
void ForthDumpDict(ushort latest) { ushort dictEnd=latest+64; // The format is: flags, name (not zero terminated), previous NFA, // currentNFA. Emit('>'); while(latest<dictEnd) { Emit(' '); byte dictbyte; ReadMem(dictbyte,latest++); // get the byte at here. DotHex(dictbyte); } }
void RegExpMacroAssemblerIrregexp::GoTo(Label* l) { if (advance_current_end_ == pc_) { // Combine advance current and goto. pc_ = advance_current_start_; Emit(BC_ADVANCE_CP_AND_GOTO, advance_current_offset_); EmitOrLink(l); advance_current_end_ = kInvalidPC; } else { // Regular goto. Emit(BC_GOTO, 0); EmitOrLink(l); } }
void RegExpMacroAssemblerIrregexp::CheckNotCharacterAfterAnd( uint32_t c, uint32_t mask, Label* on_not_equal) { if (c > MAX_FIRST_ARG) { Emit(BC_AND_CHECK_NOT_4_CHARS, 0); Emit32(c); } else { Emit(BC_AND_CHECK_NOT_CHAR, c); } Emit32(mask); EmitOrLink(on_not_equal); }
void EhFrame::FDE::Begin() { Entry::Begin(); const uword cie_id = writer->Count(); Emit(cie_id); // Write pc <begin, range> placeholder pcBeginOffset = writer->Count(); const void* pc = nullptr; Emit(pc); Emit(pc); }
bool CPSBlood::Update(const float &time, const double &elapsedTime) { if (m_fDieTime > 0.0f && m_fDieTime <= time) dying = true; m_fBrightness += m_fBrightnessDelta*elapsedTime; if( m_fBrightness <= 0.0f) m_fBrightness = 0.0f; if (dying && m_iNumParticles == 0) return 1; if (!(m_iFlags & RENDERSYSTEM_FLAG_DONTFOLLOW)) cl_entity_t *pFollow = FollowEntity(); if (m_iFlags & RENDERSYSTEM_FLAG_SIMULTANEOUS) Emit(m_iMaxParticles); else if (m_fNextEmitTime <= time) { Emit(1); m_fNextEmitTime = time + 1.0f/(float)m_iMaxParticles; } CParticle *curPart = NULL; pmtrace_t pmtrace; gEngfuncs.pEventAPI->EV_SetSolidPlayers(-1); gEngfuncs.pEventAPI->EV_SetTraceHull(2); for (int i = 0; i < m_iNumParticles; ++i) { curPart = &m_pParticleList[i]; if (curPart->m_fEnergy <= 0.0f) m_pParticleList[i] = m_pParticleList[--m_iNumParticles]; VectorCopy(curPart->m_vPos, curPart->m_vPosPrev); VectorMA(curPart->m_vVel, elapsedTime, curPart->m_vAccel, curPart->m_vVel); VectorMA(curPart->m_vPos, elapsedTime, curPart->m_vVel, curPart->m_vPos); gEngfuncs.pEventAPI->EV_PlayerTrace(curPart->m_vPosPrev, curPart->m_vPos, PM_WORLD_ONLY, -1, &pmtrace); if (pmtrace.fraction >= 1.0f) curPart->m_fEnergy -= 1.5f * elapsedTime; else curPart->m_fEnergy = -1.0f; if (gEngfuncs.pfnRandomLong(0,0x7FFF) < (0x7fff/4)) EV_DecalTrace(&pmtrace, EV_BloodDecal()); } return 0; }
////////////////////////////////////////////////////////////////////////// // // Class ReturnStmt // void ReturnStmt::Gen( int b, int a, bool bASM ) { if ( bASM ) GenMovLineno( m_lineno ); Expr* pExpr = m_pExpr->Gen(); Temp* temp = new Temp( m_pExpr->m_pType ); Emit( temp->ToString() + " = " + pExpr->ToString() ); Emit( "leave " + temp->ToString() ); delete temp; delete pExpr; }
////////////////////////////////////////////////////////////////////////// // // Class Constant // void Constant::Jumping( int t, int f ) { char code[ 20 ]; if ( m_pTok->m_Tag == Tag::TRUETYPE && t != 0 ) { sprintf_s( code, "goto L%d", t ); Emit( code ); } else if ( m_pTok->m_Tag == Tag::FALSETYPE && f != 0 ) { sprintf_s( code, "goto L%d", f ); Emit( code ); } }
void Clock::RaiseAccumulatedEvents () { if ((queued_events & CURRENT_TIME_INVALIDATED) != 0) { Emit (CurrentTimeInvalidatedEvent); } if ((queued_events & CURRENT_STATE_INVALIDATED) != 0) { if (state != Clock::Stopped) has_started = true; Emit (CurrentStateInvalidatedEvent); } queued_events = 0; }
void LineBrush::DrawLine(int xpos, int ypos, int color){ int ix = getDirection (xpos, lastX); int iy = getDirection (ypos, lastY); //std::cout <<" Last X " << lastX <<" ix" << xIterator; int delta_x = GetDelta(xpos , lastX); int delta_y = GetDelta(ypos , lastY); int saveXpos = xpos; int saveYpos = ypos; if (delta_x >= delta_y) { // error may go below zero int error(delta_y - (delta_x >> 1)); while (xpos != lastX) { if ((error >= 0) && (error || (ix > 0))) { error -= delta_x; ypos += iy; } // else do nothing error += delta_y; xpos += ix; Emit(xpos,ypos, color); } }
void ContentControl::OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error) { if (args->GetProperty ()->GetOwnerType () != Type::CONTENTCONTROL) { Control::OnPropertyChanged (args, error); return; } if (args->GetId () == ContentControl::ContentProperty) { if (args->GetOldValue() && args->GetOldValue()->Is(GetDeployment (), Type::FRAMEWORKELEMENT)) { if (GetContentSetsParent ()) { args->GetOldValue()->AsFrameworkElement()->SetLogicalParent (NULL, error); if (error->number) return; } } if (args->GetNewValue() && args->GetNewValue()->Is(GetDeployment (), Type::FRAMEWORKELEMENT)) { if (GetContentSetsParent ()) { args->GetNewValue()->AsFrameworkElement()->SetLogicalParent (this, error); if (error->number) return; } } if (HasHandlers (ContentControl::ContentControlChangedEvent)) Emit (ContentControl::ContentControlChangedEvent, new ContentControlChangedEventArgs (args->GetOldValue(), args->GetNewValue())); InvalidateMeasure (); } NotifyListenersOfPropertyChange (args, error); }
#include "glexplosion.h" #include "mmsystem.h" //*****************************************************************************/ glExplosion::glExplosion(int numParticles, vec3 origin, float spread, GLuint texture) : m_texture(texture), m_spread(spread), glParticleSystem(numParticles, origin) { srand(timeGetTime()); glParticleSystem::InitializeSystem(); Emit(numParticles); }