Beispiel #1
0
nsresult CharacterData::BindToTree(Document* aDocument, nsIContent* aParent,
                                   nsIContent* aBindingParent) {
  MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
  MOZ_ASSERT(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
             "Must have the same owner document");
  MOZ_ASSERT(!aParent || aDocument == aParent->GetUncomposedDoc(),
             "aDocument must be current doc of aParent");
  MOZ_ASSERT(!GetUncomposedDoc() && !IsInUncomposedDoc(),
             "Already have a document.  Unbind first!");
  MOZ_ASSERT(!IsInComposedDoc(), "Already have a document.  Unbind first!");
  // Note that as we recurse into the kids, they'll have a non-null parent.  So
  // only assert if our parent is _changing_ while we have a parent.
  MOZ_ASSERT(!GetParent() || aParent == GetParent(),
             "Already have a parent.  Unbind first!");
  MOZ_ASSERT(!GetBindingParent() || aBindingParent == GetBindingParent() ||
                 (!aBindingParent && aParent &&
                  aParent->GetBindingParent() == GetBindingParent()),
             "Already have a binding parent.  Unbind first!");
  MOZ_ASSERT(aBindingParent != this,
             "Content must not be its own binding parent");
  MOZ_ASSERT(!IsRootOfNativeAnonymousSubtree() || aBindingParent == aParent,
             "Native anonymous content must have its parent as its "
             "own binding parent");

  if (!aBindingParent && aParent) {
    aBindingParent = aParent->GetBindingParent();
  }

  // First set the binding parent
  if (aBindingParent) {
    NS_ASSERTION(IsRootOfNativeAnonymousSubtree() ||
                     !HasFlag(NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE) ||
                     (aParent && aParent->IsInNativeAnonymousSubtree()),
                 "Trying to re-bind content from native anonymous subtree to "
                 "non-native anonymous parent!");
    ExtendedContentSlots()->mBindingParent =
        aBindingParent;  // Weak, so no addref happens.
    if (aParent->IsInNativeAnonymousSubtree()) {
      SetFlags(NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE);
    }
    if (aParent->HasFlag(NODE_HAS_BEEN_IN_UA_WIDGET)) {
      SetFlags(NODE_HAS_BEEN_IN_UA_WIDGET);
    }
    if (HasFlag(NODE_IS_ANONYMOUS_ROOT)) {
      aParent->SetMayHaveAnonymousChildren();
    }
  }

  if (aParent && aParent->IsInShadowTree()) {
    ClearSubtreeRootPointer();
    SetFlags(NODE_IS_IN_SHADOW_TREE);
    SetIsConnected(aParent->IsInComposedDoc());
    MOZ_ASSERT(aParent->GetContainingShadow());
    ExtendedContentSlots()->mContainingShadow = aParent->GetContainingShadow();
  }

  bool hadParent = !!GetParentNode();

  // Set parent
  if (aParent) {
    if (!GetParent()) {
      NS_ADDREF(aParent);
    }
    mParent = aParent;
  } else {
    mParent = aDocument;
  }
  SetParentIsContent(aParent);

  // XXXbz sXBL/XBL2 issue!

  // Set document
  if (aDocument) {
    // We no longer need to track the subtree pointer (and in fact we'll assert
    // if we do this any later).
    ClearSubtreeRootPointer();

    // XXX See the comment in Element::BindToTree
    SetIsInDocument();
    SetIsConnected(true);
    if (mText.IsBidi()) {
      aDocument->SetBidiEnabled();
    }
    // Clear the lazy frame construction bits.
    UnsetFlags(NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES);
  } else if (!IsInShadowTree()) {
    // If we're not in the doc and not in a shadow tree,
    // update our subtree pointer.
    SetSubtreeRootPointer(aParent->SubtreeRoot());
  }

  nsNodeUtils::ParentChainChanged(this);
  if (!hadParent && IsRootOfNativeAnonymousSubtree()) {
    nsNodeUtils::NativeAnonymousChildListChange(this, false);
  }

  UpdateEditableState(false);

  MOZ_ASSERT(aDocument == GetUncomposedDoc(), "Bound to wrong document");
  MOZ_ASSERT(aParent == GetParent(), "Bound to wrong parent");
  MOZ_ASSERT(aBindingParent == GetBindingParent(),
             "Bound to wrong binding parent");

  return NS_OK;
}
Beispiel #2
0
static char *GetOPGroup( char subtype )
  {
    SetFlags( group_flags[ subtype-'0' ][ REG(modrm()) ] );
 return groups[subtype-'0'][REG(modrm())];
}
TView::TView(ERect frame, const char *name, euint32 resizingMode, euint32 flags)
	: EView(frame, name, resizingMode, flags)
{
	SetViewColor(216, 216, 216);

#if TEST_SCROLLBAR
	ERect cR = Bounds();
	ERect hR = Bounds();
	ERect vR = Bounds();

	cR.right -= 11;
	cR.bottom -= 11;

	hR.top = hR.bottom - 10;
	hR.right -= 10;
	vR.left = vR.right - 10;
	vR.bottom -= 10;

	EBox *box = new EBox(cR, NULL, E_FOLLOW_ALL);
	box->SetLabelAlignment(E_ALIGN_CENTER);
	box->SetLabel("装饰框框");
	AddChild(box);
#else
	EBox *box = new EBox(Bounds().InsetByCopy(-150, -150).OffsetToCopy(0, 0), NULL, E_FOLLOW_NONE);
	box->SetLabelAlignment(E_ALIGN_CENTER);
	box->SetLabel("装饰框框");
#endif

	ETextControl *edt = new ETextControl(ERect(10, 100, 250, 130), NULL,
					     "主题:", "这个世界日新月异", NULL,
					     E_FOLLOW_NONE, E_WILL_DRAW | E_FRAME_EVENTS | E_NAVIGABLE);
	edt->SetDivider(100);
	edt->SetAlignment(E_ALIGN_RIGHT, E_ALIGN_CENTER);
//	edt->HideTyping(true);
//	edt->HideTyping('*');
	edt->ResizeToPreferred();
	box->AddChild(edt);

	EButton *btn = new EButton(ERect(10, 280, 50, 300), NULL, "按钮", NULL);
	btn->SetFontSize(20);
	box->AddChild(btn);
	btn->ResizeToPreferred();

#if TEST_CHECKBOX
	ECheckBox *cbox = new ECheckBox(ERect(280, 60, 380, 90), NULL, "检查按钮", NULL);
	box->AddChild(cbox);
#endif

#if TEST_RADIOBUTTON
	EView *rbtns_group = new EView(ERect(430, 60, 530, 150), NULL, E_FOLLOW_NONE, 0);
	rbtns_group->AddChild(new ERadioButton(ERect(0, 0, 100, 30), NULL, "组合按钮1", NULL));
	rbtns_group->AddChild(new ERadioButton(ERect(0, 30, 100, 60), NULL, "组合按钮2", NULL));
	rbtns_group->AddChild(new ERadioButton(ERect(0, 60, 100, 90), NULL, "组合按钮3", NULL));
	box->AddChild(rbtns_group);
#endif

#if TEST_LISTVIEW
	EListView *listView = new EListView(ERect(0, 0, 200, 300), NULL, E_MULTIPLE_SELECTION_LIST, E_FOLLOW_NONE);
	listView->AddItem(new EStringItem("Item1"));
	listView->AddItem(new EStringItem("Item2", 1));
	listView->AddItem(new EStringItem("Item3"));
	listView->AddItem(new EStringItem("Item4", 2));
	listView->AddItem(new EStringItem("Item5"));
	listView->AddItem(new EStringItem("Item6"));
	listView->AddItem(new EStringItem("Item7"));
	listView->AddItem(new EStringItem("Item8"));
	listView->AddItem(new EStringItem("Item9"));
	listView->AddItem(new EStringItem("Item10"));
	listView->AddItem(new EStringItem("Item11"));
	listView->AddItem(new EStringItem("Item12"));
	listView->AddItem(new EStringItem("Item13"));
	box->AddChild(new EScrollView(ERect(100, 180, 250, 280), NULL, listView, E_FOLLOW_NONE));


	EOutlineListView *outline = new EOutlineListView(ERect(0, 0, 400, 300), NULL, E_SINGLE_SELECTION_LIST, E_FOLLOW_NONE);
	EListItem *region, *state, *locality;
	outline->AddItem(region = new EStringItem("United States of America"));
	outline->AddUnder(state = new EStringItem("California"), region);
	outline->AddUnder(new EStringItem("Menlo Park"), state);
	outline->AddUnder(new EStringItem("Los Angeles"), state);
	outline->AddUnder(locality = new EStringItem("New York"), region);
	outline->AddUnder(new EStringItem("Albany"), locality);
	outline->AddUnder(new EStringItem("Buffalo"), locality);
	outline->AddUnder(new EStringItem("New York City"), locality);
	outline->AddItem(region = new EStringItem("Europe"));
	outline->AddUnder(locality = new EStringItem("France"), region);
	outline->AddUnder(new EStringItem("Paris"), locality);
	outline->AddUnder(locality = new EStringItem("Germany"), region);
	outline->AddUnder(new EStringItem("Berlin"), locality);
	outline->AddUnder(new EStringItem("Hamburg"), locality);
	outline->AddUnder(locality = new EStringItem("Italy"), region);
	outline->AddUnder(new EStringItem("Milan"), locality);
	outline->AddUnder(new EStringItem("Rome"), locality);
	box->AddChild(new EScrollView(ERect(100, 300, 350, 450), NULL, outline, E_FOLLOW_NONE));
#endif


#if TEST_TEXTVIEW
	e_text_run_array array;
	array.count = 1;
	array.runs[0].font = *etk_plain_font;

	ETextView *textView = new ETextView(ERect(0, 0, 450, 200), NULL, ERect(0, 0, 450, 200));
//	textView->HideTyping(true);
//	textView->HideTyping('*');
	textView->SetAutoindent(true);

	array.runs[0].offset = 16;
	array.runs[0].font.SetSize(16);
	array.runs[0].color.set_to(0, 0, 200, 255);
	array.runs[0].background.set_to(255, 255, 0, 255);
	array.runs[0].underline = false;
	textView->Insert("This is a test, Be", &array);

	array.runs[0].offset = 0;
	array.runs[0].color.set_to(200, 0, 0, 255);
	textView->Insert(-1, "OS", -1, &array);

	array.runs[0].offset = 0;
	array.runs[0].font.SetSize(12);
	array.runs[0].color.set_to(200, 0, 200, 255);
	array.runs[0].background.alpha = 0;
	textView->Insert(-1, " style TextView, just enjoy it. :)\n", -1, &array);

	array.runs[0].offset = 0;
	array.runs[0].font = *etk_bold_font;
	array.runs[0].font.SetSize(20);
	array.runs[0].color.set_to(200, 0, 0, 255);
	array.runs[0].underline = true;
	textView->Insert(-1, "多行", -1, &array);

	array.runs[0].offset = 0;
	array.runs[0].font.SetSize(16);
	array.runs[0].color.set_to(0, 50, 0, 255);
	array.runs[0].underline = true;
	textView->Insert(-1, "文本", -1, &array);

	array.runs[0].offset = 0;
	array.runs[0].font.SetSize(30);
	array.runs[0].color.set_to(0, 0, 200, 255);
	array.runs[0].underline = false;
	textView->Insert(-1, "编辑", -1, &array);

	array.runs[0].offset = 0;
	array.runs[0].font = *etk_plain_font;
	array.runs[0].font.SetSize(10);
	array.runs[0].color.set_to(0, 0, 0, 255);
	textView->Insert(-1, "测试...", -1, &array);

	textView->Select(5, 20, true);

	box->AddChild(new EScrollView(ERect(100, 500, 350, 650), NULL, textView, E_FOLLOW_NONE));
#endif


#if TEST_TABVIEW
	ETabView *tabView = new ETabView(ERect(360, 300, 700, 500), NULL, E_WIDTH_FROM_LABEL, E_FOLLOW_NONE);
	ERect tabVR = tabView->ContainerView()->Bounds();

	ETab *tab = new ETab(new EStringView(tabVR, NULL, "Hello, This is the TAB 1.\nShow it...", E_FOLLOW_ALL));
	tab->SetLabel("Tab 1");
	tabView->AddTab(NULL, tab);

	tab = new ETab(new EColorControl(EPoint(5, 5), NULL, NULL, true));
	tab->SetLabel(">> ColorControl <<");
	tabView->AddTab(NULL, tab);

	tab = new ETab(new EStringView(tabVR, NULL, "Hello, This is the ** TAB 3 **.\nShow it...", E_FOLLOW_ALL));
	tab->SetLabel("  Tab 3  ");
	tabView->AddTab(NULL, tab);

	box->AddChild(tabView);
#endif

#if TEST_SCROLLBAR
	EScrollBar *hScrollBar = new EScrollBar(hR, NULL, 0, -100, 100, E_HORIZONTAL);
	EScrollBar *vScrollBar = new EScrollBar(vR, NULL, 0, -100, 100, E_VERTICAL);
	AddChild(hScrollBar);
	AddChild(vScrollBar);

	hScrollBar->SetTarget(box);
	vScrollBar->SetTarget(box);
#else
	EScrollView *scv = new EScrollView(Bounds(), NULL, box, E_FOLLOW_ALL);
	AddChild(scv);
#endif

#if TEST_STATUSBAR
	fStatusBar = new EStatusBar(ERect(280, 250, 500, 290), NULL, "进度条示例:", "/100");
	box->AddChild(fStatusBar);
	SetFlags(Flags() | E_PULSE_NEEDED);
#endif

#if TEST_MENUFIELD
	EMenu *menu = new EMenu("Options", E_ITEMS_IN_COLUMN);
	menu->SetLabelFromMarked(true);

	menu->AddItem(new EMenuItem("First Item", NULL));
	menu->AddSeparatorItem();
	menu->AddItem(new EMenuItem("Item", NULL));
	menu->AddItem(new EMenuItem("Item Item", NULL));
	menu->AddItem(new EMenuItem("Item Item Item", NULL));
	menu->AddItem(new EMenuItem("Item Item Item Item", NULL));
	menu->AddSeparatorItem();
	menu->AddItem(new EMenuItem("Last Item", NULL));
	menu->ItemAt(0)->SetMarked(true);

	EMenuField *menuField = new EMenuField(ERect(280, 150, 500, 200), NULL, "候选框:", menu, true);
	box->AddChild(menuField);
#endif
}
Beispiel #4
0
static void S9xSoftResetCPU (void)
{
	Registers.PBPC = 0;
	Registers.PB = 0;
	CPU.InDMAorHDMA = TRUE; // hangs on addCyclesInMemoryAccess_x2 when S9X_ACCURACY_LEVEL >= 2
	Registers.PCw = S9xGetWord(0xfffc);
	OpenBus = Registers.PCh;
	Registers.D.W = 0;
	Registers.DB = 0;
	Registers.SH = 1;
	Registers.SL -= 3;
	Registers.XH = 0;
	Registers.YH = 0;

	ICPU.ShiftedPB = 0;
	ICPU.ShiftedDB = 0;
	SetFlags(MemoryFlag | IndexFlag | IRQ | Emulation);
	ClearFlags(Decimal);

	CPU.Cycles = 182; // Or 188. This is the cycle count just after the jump to the Reset Vector.
	CPU.PrevCycles = -1;
	CPU.V_Counter = 0;
	CPU.Flags = CPU.Flags & (DEBUG_MODE_FLAG | TRACE_FLAG);
	CPU.PCBase = NULL;
	CPU.IRQActive = FALSE;
	CPU.IRQPending = 0;
	CPU.MemSpeed = SLOW_ONE_CYCLE;
	CPU.MemSpeedx2 = SLOW_ONE_CYCLE * 2;
	CPU.FastROMSpeed = SLOW_ONE_CYCLE;
	CPU.InDMA = FALSE;
	CPU.InHDMA = FALSE;
	CPU.InDMAorHDMA = FALSE;
	CPU.InWRAMDMAorHDMA = FALSE;
	CPU.HDMARanInDMA = 0;
	CPU.CurrentDMAorHDMAChannel = -1;
	CPU.WhichEvent = HC_RENDER_EVENT;
	CPU.NextEvent  = Timings.RenderPos;
	CPU.WaitingForInterrupt = FALSE;
	CPU.WaitAddress = 0xffffffff;
	CPU.WaitCounter = 0;
	CPU.PBPCAtOpcodeStart = 0xffffffff;
	CPU.AutoSaveTimer = 0;
	CPU.SRAMModified = FALSE;

	Timings.InterlaceField = FALSE;
	Timings.H_Max = Timings.H_Max_Master;
	Timings.V_Max = Timings.V_Max_Master;
	Timings.NMITriggerPos = 0xffff;
	if (Model->_5A22 == 2)
		Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v2;
	else
		Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v1;

	S9xSetPCBase(Registers.PBPC);

	ICPU.S9xOpcodes = S9xOpcodesE1;
	ICPU.S9xOpLengths = S9xOpLengthsM1X1;
	ICPU.CPUExecuting = TRUE;

	S9xUnpackStatus();
}
// caption frame
nsTableCaptionFrame::nsTableCaptionFrame(nsStyleContext* aContext):
  nsBlockFrame(aContext)
{
  // shrink wrap 
  SetFlags(NS_BLOCK_FLOAT_MGR);
}
Beispiel #6
0
void WebAddress::Combine(WebAddress Base)
{
	//Strings are hard coded to reduce code size
	String_256 sSlashDotSlash="/./";
	String_256 sSlashDotDotSlash="/../";
	
	TCHAR cSlash='/';

	//Now start the parsing.

	//If the base Web Address is empty, this Web Address does not change
	if (Base.IsEmpty())
		goto ReturnNow;

	//If this Web Address is empty, then it inherits everything from the 
	//base Web Address
	if (IsEmpty())
	{
		Absolute = Base.Absolute;

		Scheme=Base.Scheme;
		NetLoc=Base.NetLoc;
		Path=Base.Path;
		Parameters=Base.Parameters;
		Query=Base.Query;
		Fragment=Base.Fragment;
		goto ReturnNow;
	}

	//If this Web Address is absolute, it does not change
	if (IsAbsolute())
		goto ReturnNow;

	//If none of the above apply, this Web Address inherits the scheme of
	//the Base address
	Scheme=Base.Scheme;

	//If this Web Address has a net location, we need do nothing more to it.
	if (!NetLoc.IsEmpty())
		goto ReturnNow;

	//Otherwise, this Web Address inherits the Net Location of the base address.
	NetLoc=Base.NetLoc;

	//If the path of this Web Address starts with a slash, it is non-relative
	//and we need only add it on to the Net Location
	if ((*(Path))==cSlash) goto ReturnNow;


	//This is where all the loops within loops start. Hang on to your curly brackets.

	//Does this Web Address have a path?
	if (!Path.IsEmpty())
	{
		//Yes. Then the full path is given by:
		//The Base URL path up to the rightmost slash + the URL of this Web Address
		
		//This string will hold the base URL path up to the rightmost slash
		String_256 sTempPath="";
		
		//First find the rightmost slash in Base.Path
		INT32 iFound=Base.Path.ReverseFind(cSlash);
		
		//Did we find a slash?
		if (iFound>=0)
		{
			//Yes. So copy everything up to that slash into sTempPath


			Base.Path.Split(&sTempPath, NULL, iFound, TRUE);
			
			sTempPath+=Path;

			Path=sTempPath;
		}//End IF there's a slash in Base.Path

		
		//We now need to check the path for ../ and ./
		//First let's search for /./
		iFound=Path.Sub(sSlashDotSlash);

		//If we've found a /./
		while (iFound>=0)
		{
			//Then remove the ./ part of it.
			Path.Remove(iFound+1, 2);

			//And look for the next /./ to remove
			iFound=Path.Sub(sSlashDotSlash);
		}

		//Now we want to remove all occurrences of /[path segment/../
		//So first let's do a search for /../
		
		iFound=Path.Sub(sSlashDotDotSlash);

		//If we've found a /./
		while (iFound>=0)
		{
			//Then go back until we find the start of the path segment before it
			INT32 iStartOfSection=iFound-1;

			while (iStartOfSection>=0 && Path[iStartOfSection]!=cSlash)
				iStartOfSection--;

			if (iStartOfSection>=0)
			{
				//Get iStartOfSection to represent the character after the slash,
				//rather than the slash
				iStartOfSection++;

				//So if we've found something, then set a pointer to the end of that
				//section
				INT32 iEndOfSection=iFound+3;

				Path.Remove(iStartOfSection, (iEndOfSection-iStartOfSection+1));
			}
			else
				//If we found an unparsable /../, then break now before we
				//get into trouble...
				break;

			//And find the next /../
			iFound=Path.Sub(sSlashDotDotSlash);
		}	
	}
	else
	{
		//No, this Web Address doesn't have a path.
		//So it inherits the path of the base URL.
		Path=Base.Path;

		//If this Web Address has some parameters, we need do nothin more to it
		if (!Parameters.IsEmpty())
			goto ReturnNow;

		//Otherwise this Web Address inherits the parameters of the base URL
		Parameters=Base.Parameters;

		//If this Web Address has a query, we need do nothin more to it
		if (!Query.IsEmpty())
			goto ReturnNow;

		//Otherwise this Web Address inherits the parameters of the base URL
		Query=Base.Query;

		//And that's it. (Fragments are never inherited).
		//So we can return.
		goto ReturnNow;

	}//End if (!Path.IsEmpty()) else...

ReturnNow:
	//Set the "Absolute" flag to whatever it's meant to be, and return
	SetFlags();
	return;
}
Beispiel #7
0
bool
DownloadProgressView::Init(BMessage* archive)
{
	fCurrentSize = 0;
	fExpectedSize = 0;
	fLastUpdateTime = 0;
	fBytesPerSecond = 0.0;
	for (size_t i = 0; i < kBytesPerSecondSlots; i++)
		fBytesPerSecondSlot[i] = 0.0;
	fCurrentBytesPerSecondSlot = 0;
	fLastSpeedReferenceSize = 0;
	fEstimatedFinishReferenceSize = 0;

	fProcessStartTime = fLastSpeedReferenceTime = fEstimatedFinishReferenceTime
		= system_time();

	SetViewColor(245, 245, 245);
	SetFlags(Flags() | B_FULL_UPDATE_ON_RESIZE | B_WILL_DRAW);

	if (archive) {
		fStatusBar = new BStatusBar("download progress", fPath.Leaf());
		float value;
		if (archive->FindFloat("value", &value) == B_OK)
			fStatusBar->SetTo(value);
	} else
		fStatusBar = new BStatusBar("download progress", "Download");
	fStatusBar->SetMaxValue(100);
	fStatusBar->SetBarHeight(12);

	// fPath is only valid when constructed from archive (fDownload == NULL)
	BEntry entry(fPath.Path());

	if (archive) {
		if (!entry.Exists())
			fIconView = new IconView(archive);
		else
			fIconView = new IconView(entry);
	} else
		fIconView = new IconView();

	if (!fDownload && (fStatusBar->CurrentValue() < 100 || !entry.Exists()))
		fTopButton = new SmallButton("Restart", new BMessage(RESTART_DOWNLOAD));
	else {
		fTopButton = new SmallButton("Open", new BMessage(OPEN_DOWNLOAD));
		fTopButton->SetEnabled(fDownload == NULL);
	}
	if (fDownload)
		fBottomButton = new SmallButton("Cancel", new BMessage(CANCEL_DOWNLOAD));
	else {
		fBottomButton = new SmallButton("Remove", new BMessage(REMOVE_DOWNLOAD));
		fBottomButton->SetEnabled(fDownload == NULL);
	}

	fInfoView = new BStringView("info view", "");

	BGroupLayout* layout = GroupLayout();
	layout->SetInsets(8, 5, 5, 6);
	layout->AddView(fIconView);
	BView* verticalGroup = BGroupLayoutBuilder(B_VERTICAL, 3)
		.Add(fStatusBar)
		.Add(fInfoView)
		.TopView()
	;
	verticalGroup->SetViewColor(ViewColor());
	layout->AddView(verticalGroup);
	verticalGroup = BGroupLayoutBuilder(B_VERTICAL, 3)
		.Add(fTopButton)
		.Add(fBottomButton)
		.TopView()
	;
	verticalGroup->SetViewColor(ViewColor());
	layout->AddView(verticalGroup);

	BFont font;
	fInfoView->GetFont(&font);
	float fontSize = font.Size() * 0.8f;
	font.SetSize(max_c(8.0f, fontSize));
	fInfoView->SetFont(&font, B_FONT_SIZE);
	fInfoView->SetHighColor(tint_color(fInfoView->LowColor(),
		B_DARKEN_4_TINT));
	fInfoView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));

	return true;
}
Beispiel #8
0
void wxSettableHeaderColumn::ClearFlag(int flag)
{
    int flags = GetFlags();
    if ( flags & flag )
        SetFlags(flags & ~flag);
}
Beispiel #9
0
/*************************************************
            ITU0同期割り込み関数
--------------------------------------------------
* H8外部クロック25MHz
* 100Hzで割り込み発生
*
**************************************************/
void INT_IMIA1(void)
{
	unsigned char i;
	
	//生存信号
	if(itu1_cnt % ALV_PERIOD == 0)	SetFlags(flag_alive);
	
	// AD変換,マルチプレクサスイッチング
//	if((itu1_cnt % DIV_AD) % DIV_MPX == 0 && (itu1_cnt % DIV_AD) <=35){	// DIV_AD/10 * 7

	if((itu1_cnt % DIV_AD) % DIV_MPX == 0 && (itu1_cnt % DIV_AD) <=70){	// DIV_AD/10 * 7
		SetFlags(flag_ad);
	}
	
	// AD変換結果表示
	if(itu1_cnt % DIV_AD == 0)	SetFlags(flag_dispAD);
	
	//コマンド実行
	if(itu1_cnt % DIV_EXE == 0)	SetFlags(flag_exe);
	
	//渦電流検知テレメトリ
	if(itu1_cnt % DIV_OVERAMPARE == 0)	SetFlags(flag_overa);
	
	// 粗テレメトリ
	if(itu1_cnt % DIV_ROUGHTELEME == 0)	SetFlags(flag_rteleme);
	
	// 詳細テレメトリ
	if(itu1_cnt % DIV_DETAILEDTELEME == 0)	SetFlags(flag_dteleme);
	
	// APIテレメトリ
	if(itu1_cnt % DIV_APITELEME == 0)	SetFlags(flag_ateleme);
	
	// 初期化情報テレメトリ
	if(itu1_cnt % DIV_ITELEME == 0)	SetFlags(flag_iteleme);
	
	// パワーテレメトリ
	if(itu1_cnt % DIV_PTELEME == 0)	SetFlags(flag_pwrt);
	
	// ミッションテレメトリ
	if(itu1_cnt % DIV_MTELEME == 0) SetFlags(flag_misst);
	
	// シリアル通信メッセージチェック
	if(itu1_cnt % DIV_MESSAGE == 0)	SetFlags(flag_scirx);
	
	// RXチェック
	if(itu1_cnt % DIV_RX == 0)	SetFlags(flag_rx);
	
	// TXチェック
	if(itu1_cnt % DIV_TX == 0)	SetFlags(flag_tx);
	
	//パワーから返事が返って来ているかの確認
	if(itu1_cnt % DIV_CPR == 0)  SetFlags(flag_cpr);
	
	// 試験用テレメトリ出力
	if(itu1_cnt % DIV_OUTPUTTELEME == 0) SetFlags(flag_oteleme);
	
	//ミッションCPU起動(タイマ予約型、タイマ予約&作動時間指定型)
	if((smr_time>0)&&(itu1_cnt > smr_time)){
		SetFlags(flag_smr);
	}
	//ミッションCPUシャットダウン(タイマ予約&作動時間指定型)
	if((sms_time>0)&&(itu1_cnt > sms_time)){
		SetFlags(flag_sms);
	}
	//PICオン要求
	if(itu1_cnt % DIV_PIC == 0) SetFlags(flag_pic);
	
	/*デバッグ用*/
	mission_cnt=itu1_cnt;
	
	itu1_cnt++;
	
	if(itu1_cnt >= 0xFFFFFFFE)	// 0.001*4294967296(sec) = 500(day)でクリア
	{
		itu1_cnt = 0;
	}
	
	if(CheckFlags(ena_mywdt)){
		my_wdt++;		// main loopでクリア
		if(my_wdt >= OVERFLOW)	RequestMainShutdown();	// 自己リセット要求
	}
	
	status.obctime[3] =  itu1_cnt			& 0x00ff;
	status.obctime[2] = (itu1_cnt >>  8)	& 0x00ff;
	status.obctime[1] = (itu1_cnt >> 16)	& 0x00ff;
	status.obctime[0] = (itu1_cnt >> 24)	& 0x00ff;
	
	ITU.TISRA.BIT.IMFA1 = 0;				// 割り込みステータスフラグクリア
}
JSBool
WrapObject(JSContext *cx, JSObject *parent, jsval *vp, XPCWrappedNative* wn)
{
  NS_ASSERTION(XPCPerThreadData::IsMainThread(cx),
               "Can't do this off the main thread!");

  // Our argument should be a wrapped native object, but the caller may have
  // passed it in as an optimization.
  JSObject *wrappedObj;
  if (JSVAL_IS_PRIMITIVE(*vp) ||
      !(wrappedObj = JSVAL_TO_OBJECT(*vp)) ||
      wrappedObj->getClass() == &XOWClass) {
    return JS_TRUE;
  }

  if (!wn &&
      !(wn = XPCWrappedNative::GetAndMorphWrappedNativeOfJSObject(cx, wrappedObj))) {
    return JS_TRUE;
  }

  CheckWindow(wn);

  // The parent must be the inner global object for its scope.
  parent = JS_GetGlobalForObject(cx, parent);
  OBJ_TO_INNER_OBJECT(cx, parent);
  if (!parent) {
    return JS_FALSE;
  }

  XPCWrappedNativeWithXOW *wnxow = nsnull;
  if (wn->NeedsXOW()) {
    JSObject *innerWrappedObj = wrappedObj;
    OBJ_TO_INNER_OBJECT(cx, innerWrappedObj);
    if (!innerWrappedObj) {
      return JS_FALSE;
    }

    if (innerWrappedObj == parent) {
      wnxow = static_cast<XPCWrappedNativeWithXOW *>(wn);
      JSObject *xow = wnxow->GetXOW();
      if (xow) {
        *vp = OBJECT_TO_JSVAL(xow);
        return JS_TRUE;
      }
    }
  }

  XPCWrappedNative *parentwn =
    XPCWrappedNative::GetWrappedNativeOfJSObject(cx, parent);
  XPCWrappedNativeScope *parentScope;
  if (NS_LIKELY(parentwn)) {
    parentScope = parentwn->GetScope();
  } else {
    parentScope = XPCWrappedNativeScope::FindInJSObjectScope(cx, parent);
  }

  JSObject *outerObj = nsnull;
  WrappedNative2WrapperMap *map = parentScope->GetWrapperMap();

  outerObj = map->Find(wrappedObj);
  if (outerObj) {
    NS_ASSERTION(outerObj->getClass() == &XOWClass,
                 "What crazy object are we getting here?");
    *vp = OBJECT_TO_JSVAL(outerObj);

    if (wnxow) {
      // NB: wnxow->GetXOW() must have returned false.
      SetFlags(cx, outerObj, AddFlags(GetFlags(cx, outerObj), FLAG_IS_CACHED));
      wnxow->SetXOW(outerObj);
    }

    return JS_TRUE;
  }

  outerObj = JS_NewObjectWithGivenProto(cx, js::Jsvalify(&XOWClass), nsnull,
                                        parent);
  if (!outerObj) {
    return JS_FALSE;
  }

  jsval flags = INT_TO_JSVAL(wnxow ? FLAG_IS_CACHED : 0);
  if (!JS_SetReservedSlot(cx, outerObj, sWrappedObjSlot, *vp) ||
      !JS_SetReservedSlot(cx, outerObj, sFlagsSlot, flags) ||
      !JS_SetReservedSlot(cx, outerObj, XPC_XOW_ScopeSlot,
                          PRIVATE_TO_JSVAL(parentScope))) {
    return JS_FALSE;
  }

  *vp = OBJECT_TO_JSVAL(outerObj);

  map->Add(wn->GetScope()->GetWrapperMap(), wrappedObj, outerObj);
  if(wnxow) {
    wnxow->SetXOW(outerObj);
  }

  return JS_TRUE;
}
Beispiel #11
0
void wxSettableHeaderColumn::SetFlag(int flag)
{
    int flags = GetFlags();
    if ( !(flags & flag) )
        SetFlags(flags | flag);
}
	void Init() 
	{
		SetFlags( ACH_LISTEN_MAP_EVENTS | ACH_SAVE_WITH_GAME );
		SetGameDirFilter( "episodic" );
		SetGoal( 1 );
	}
Beispiel #13
0
//---------------------------------------------------------------------------
String __fastcall TFMain_11011981::AnalyzeArguments(DWORD fromAdr)
{
	BYTE		op;
    bool		kb;
    bool        bpBased;
    bool        emb, lastemb;
    bool        argA, argD, argC;
    bool        inA, inD, inC;
    bool		spRestored = false;
    WORD        bpBase, retBytes;
    int         num, instrLen, instrLen1, instrLen2, _procSize;
    int			firstPopRegIdx = -1, popBytes = 0, procStackSize = 0;
    int         fromPos, curPos, Pos, reg1Idx, reg2Idx, sSize;
    DWORD       b, curAdr, Adr, Adr1;
    DWORD       lastAdr = 0, lastCallAdr = 0, lastMovAdr = 0, lastMovImm = 0;
    PInfoRec    recN, recN1;
    PARGINFO    argInfo;
    DWORD		stack[256];
    int			sp = -1;
    int			macroFrom, macroTo;
    String 		minClassName, className = "", retType = "";
    DISINFO     DisInfo, DisInfo1;

    fromPos = Adr2Pos(fromAdr);
    if (fromPos < 0) return "";
    if (IsFlagSet(cfEmbedded, fromPos)) return "";
    if (IsFlagSet(cfExport, fromPos)) return "";
    
    recN = GetInfoRec(fromAdr);
    if (!recN || !recN->procInfo) return "";

    //If cfPass is set exit
    if (IsFlagSet(cfPass, fromPos)) return recN->type;

    //Proc start
    SetFlag(cfProcStart | cfPass, fromPos);

    //Skip Imports
    if (IsFlagSet(cfImport, fromPos)) return recN->type;

    kb = (recN->procInfo->flags & PF_KBPROTO);
    bpBased = (recN->procInfo->flags & PF_BPBASED);
    emb = (recN->procInfo->flags & PF_EMBED);
    bpBase = recN->procInfo->bpBase;
    retBytes = recN->procInfo->retBytes;

    //If constructor or destructor get class name
    if (recN->kind == ikConstructor || recN->kind == ikDestructor)
        className = ExtractClassName(recN->GetName());
    //If ClassName not given and proc is dynamic, try to find minimal class
    if (className == "" && (recN->procInfo->flags & PF_DYNAMIC) && recN->xrefs)
    {
        minClassName = "";
        for (int n = 0; n < recN->xrefs->Count; n++)
        {
            PXrefRec recX = (PXrefRec)recN->xrefs->Items[n];
            if (recX->type == 'D')
            {
                className = GetClsName(recX->adr);
                if (minClassName == "" || !IsInheritsByClassName(className, minClassName)) minClassName = className;
            }
        }
        if (minClassName != "") className = minClassName;
    }
    //If ClassName not given and proc is virtual, try to find minimal class
    if (className == "" && (recN->procInfo->flags & PF_VIRTUAL) && recN->xrefs)
    {
        minClassName = "";
        for (int n = 0; n < recN->xrefs->Count; n++)
        {
            PXrefRec recX = (PXrefRec)recN->xrefs->Items[n];
            if (recX->type == 'D')
            {
                className = GetClsName(recX->adr);
                if (minClassName == "" || !IsInheritsByClassName(className, minClassName)) minClassName = className;
            }
        }
        if (minClassName != "") className = minClassName;
    }

    argA = argD = argC = true;  //On entry
    inA = inD = inC = false;    //No arguments

    _procSize = GetProcSize(fromAdr);
    curPos = fromPos; curAdr = fromAdr;

    while (1)
    {
        if (curAdr >= CodeBase + TotalSize) break;
        //Skip exception table
        if (IsFlagSet(cfETable, curPos))
        {
            //dd num
            num = *((int*)(Code + curPos));
            curPos += 4 + 8*num; curAdr += 4 + 8*num;
            continue;
        }

        BYTE b1 = Code[curPos];
        BYTE b2 = Code[curPos + 1];
        instrLen = Disasm.Disassemble(Code + curPos, (__int64)curAdr, &DisInfo, 0);
        //if (!instrLen) break;
        if (!instrLen)
        {
            curPos++; curAdr++;
            continue;
        }

        op = Disasm.GetOp(DisInfo.Mnem);
        //Code
        SetFlags(cfCode, curPos, instrLen);
        //Instruction begin
        SetFlag(cfInstruction, curPos);

        if (curAdr >= lastAdr) lastAdr = 0;

        if (op == OP_JMP)
        {
            if (curAdr == fromAdr) break;
            if (DisInfo.OpType[0] == otMEM)
            {
                if (Adr2Pos(DisInfo.Offset) < 0 && (!lastAdr || curAdr == lastAdr)) break;
            }
            if (DisInfo.OpType[0] == otIMM)
            {
                Adr = DisInfo.Immediate;
                if (Adr2Pos(Adr) < 0 && (!lastAdr || curAdr == lastAdr)) break;
                if (GetSegmentNo(Adr) != 0 && GetSegmentNo(fromAdr) != GetSegmentNo(Adr) && (!lastAdr || curAdr == lastAdr)) break;
                if (Adr < fromAdr && (!lastAdr || curAdr == lastAdr)) break;
                curPos += instrLen; curAdr += instrLen;
                continue;
            }
        }

        if (DisInfo.Ret)
        {
            //End of proc
            if (!lastAdr || curAdr == lastAdr)
            {
                //Get last instruction
                curPos -= instrLen;
                if ((DisInfo.Ret && !IsFlagSet(cfSkip, curPos)) ||   //ret not in SEH
                    IsFlagSet(cfCall, curPos))                       //@Halt0
                {
                    if (IsFlagSet(cfCall, curPos)) spRestored = true;  //acts like mov esp, ebp

                    sp = -1;
                    SetFlags(cfFrame, curPos, instrLen);
                    //ret - stop analyze output regs
                    lastCallAdr = 0; firstPopRegIdx = -1; popBytes = 0;
                    //define all pop registers (ret skipped)
                    for (Pos = curPos - 1; Pos >= fromPos; Pos--)
                    {
                        b = Flags[Pos];
                        if (b & cfInstruction)
                        {
                            //pop instruction
                            if (b & cfPop)
                            {
                                //pop ecx
                                if (b & cfSkip) break;
                                instrLen1 = Disasm.Disassemble(Code + Pos, (__int64)Pos2Adr(Pos), &DisInfo1, 0);
                                firstPopRegIdx = DisInfo1.OpRegIdx[0];
                                popBytes += 4;
                                SetFlags(cfFrame, Pos, instrLen1);
                            }
                            else
                            {
                                //skip frame instruction
                                if (b & cfFrame) continue;
                                //set eax - function
                                if (b & cfSetA)
                                {
                                    recN1 = GetInfoRec(fromAdr);
                                    recN1->procInfo->flags |= PF_OUTEAX;
                                    if (!kb && !(recN1->procInfo->flags & (PF_EVENT | PF_DYNAMIC)) &&
                                        recN1->kind != ikConstructor && recN1->kind != ikDestructor)
                                    {
                                        recN1->kind = ikFunc;
                                        Disasm.Disassemble(Code + Pos, (__int64)Pos2Adr(Pos), &DisInfo1, 0);
                                        op = Disasm.GetOp(DisInfo1.Mnem);
                                        //if setXX - return type is Boolean
                                        if (op == OP_SET) recN1->type = "Boolean";
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
                if (firstPopRegIdx!= -1)
                {
                    //Skip pushed regs
                    if (spRestored)
                    {
                        for (Pos = fromPos;;Pos++)
                        {
                            b = Flags[Pos];
                            //Proc end
                            //if (Pos != fromPos && (b & cfProcEnd))
                            if (_procSize && Pos - fromPos + 1 >= _procSize) break;
                            if (b & cfInstruction)
                            {
                                instrLen1 = Disasm.Disassemble(Code + Pos, (__int64)Pos2Adr(Pos), &DisInfo1, 0);
                                SetFlags(cfFrame, Pos, instrLen1);
                                if ((b & cfPush) && (DisInfo1.OpRegIdx[0] == firstPopRegIdx)) break;
                            }
                        }
                    }
                    else
                    {
                        for (Pos = fromPos;;Pos++)
                        {
                            if (!popBytes) break;

                            b = Flags[Pos];
                            //End of proc
                            //if (Pos != fromPos && (b & cfProcEnd))
                            if (_procSize && Pos - fromPos + 1 >= _procSize) break;
                            if (b & cfInstruction)
                            {
                                instrLen1 = Disasm.Disassemble(Code + Pos, (__int64)Pos2Adr(Pos), &DisInfo1, 0);
                                op = Disasm.GetOp(DisInfo1.Mnem);
                                SetFlags(cfFrame, Pos, instrLen1);
                                //add esp,...
                                if (op == OP_ADD && DisInfo1.OpRegIdx[0] == 20)
                                {
                                    popBytes += (int)DisInfo1.Immediate;
                                    continue;
                                }
                                //sub esp,...
                                if (op == OP_SUB && DisInfo1.OpRegIdx[0] == 20)
                                {
                                    popBytes -= (int)DisInfo1.Immediate;
                                    continue;
                                }
                                if (b & cfPush) popBytes -= 4;
                            }
                        }
                    }
                }
                //If no prototype, try add information from analyze arguments result
                if (!recN->HasName() && className != "")
                {
                    //dynamic
                    if (recN->procInfo->flags & PF_DYNAMIC)
                    {
                    }
                    else
                    {
                    }
                }
                if (!kb)
                {
                    if (inA)
                    {
                        if (className != "")
                            recN->procInfo->AddArg(0x21, 0, 4, "Self", className);
                        else
                            recN->procInfo->AddArg(0x21, 0, 4, "", "");
                    }
                    if (inD)
                    {
                        if (recN->kind == ikConstructor || recN->kind == ikDestructor)
                            recN->procInfo->AddArg(0x21, 1, 4, "_Dv__", "Boolean");
                        else
                            recN->procInfo->AddArg(0x21, 1, 4, "", "");
                    }
                    if (inC)
                    {
                        recN->procInfo->AddArg(0x21, 2, 4, "", "");
                    }
                }
                break;
            }
            if (!IsFlagSet(cfSkip, curPos)) sp = -1;
        }

        if (op == OP_MOV)
        {
            lastMovAdr = DisInfo.Offset;
            lastMovImm = DisInfo.Immediate;
        }
        //init stack via loop
        if (IsFlagSet(cfLoc, curPos))
        {
            recN1 = GetInfoRec(curAdr);
            if (recN1 && recN1->xrefs && recN1->xrefs->Count == 1)
            {
                PXrefRec recX = (PXrefRec)recN1->xrefs->Items[0];
                Adr = recX->adr + recX->offset;
                if (Adr > curAdr)
                {
                    sSize = IsInitStackViaLoop(curAdr, Adr);
                    if (sSize)
                    {
                        procStackSize += sSize * lastMovImm;
                        //skip jne
                        instrLen = Disasm.Disassemble(Code + Adr2Pos(Adr), (__int64)Adr, 0, 0);
                        curAdr = Adr + instrLen; curPos = Adr2Pos(curAdr);
                        SetFlags(cfFrame, fromPos, curAdr - fromAdr);
                        continue;
                    }
                }
            }
        }
        //add (sub) esp,...
        if (DisInfo.OpRegIdx[0] == 20 && DisInfo.OpType[1] == otIMM)
        {
            if (op == OP_ADD)
            {
                if ((int)DisInfo.Immediate < 0) procStackSize -= (int)DisInfo.Immediate;
            }
            if (op == OP_SUB)
            {
                if ((int)DisInfo.Immediate > 0) procStackSize += (int)DisInfo.Immediate;
            }
            curPos += instrLen; curAdr += instrLen;
            continue;
        }
        /*
        //dec reg
        if (op == OP_DEC && DisInfo.Op1Type == otREG)
        {
            //Save (dec reg) address
            Adr = curAdr;
            //Look next instruction
            curPos += instrLen;
            curAdr += instrLen;
            instrLen = Disasm.Disassemble(Code + curPos, (__int64)curAdr, &DisInfo1, 0);
            //If jne @1, where @1 < adr of jne, when make frame from begin if Stack inited via loop
            if (DisInfo1.Conditional && DisInfo1.Immediate < curAdr && DisInfo1.Immediate >= fromAdr)
            {
                if (IsInitStackViaLoop(DisInfo1.Immediate, Adr))
                    SetFlags(cfFrame, fromPos, curPos + instrLen - fromPos + 1);
            }
            continue;
        }
        */

        //mov esp, ebp
        if (b1 == 0x8B && b2 == 0xE5) spRestored = true;

        if (!IsFlagSet(cfSkip, curPos))
        {
            if (IsFlagSet(cfPush, curPos))
            {
                if (curPos != fromPos && sp < 255)
                {
                    sp++;
                    stack[sp] = curPos;
                }
            }
            if (IsFlagSet(cfPop, curPos) && sp >= 0)
            {
                macroFrom = stack[sp];
                SetFlag(cfBracket, macroFrom);
                macroTo = curPos;
                SetFlag(cfBracket, macroTo);
                sp--;
            }
        }

        if (b1 == 0xFF && (b2 & 0x38) == 0x20 && DisInfo.OpType[0] == otMEM && IsValidImageAdr(DisInfo.Offset)) //near absolute indirect jmp (Case)
        {
            if (!IsValidCodeAdr(DisInfo.Offset)) break;
            DWORD cTblAdr = 0, jTblAdr = 0;

            Pos = curPos + instrLen;
            Adr = curAdr + instrLen;
            //Taqble address - last 4 bytes of instruction
            jTblAdr = *((DWORD*)(Code + Pos - 4));
            //Analyze gap to find table cTbl
            if (Adr <= lastMovAdr && lastMovAdr < jTblAdr) cTblAdr = lastMovAdr;
            //If cTblAdr exists, skip it
            BYTE CTab[256];
            if (cTblAdr)
            {
                int CNum = jTblAdr - cTblAdr;
                Pos += CNum; Adr += CNum;
            }
            for (int k = 0; k < 4096; k++)
            {
                //Loc - end of table
                if (IsFlagSet(cfLoc, Pos)) break;

                Adr1 = *((DWORD*)(Code + Pos));
                //Validate Adr1
                if (!IsValidCodeAdr(Adr1) || Adr1 < fromAdr) break;
                //Set cfLoc
                SetFlag(cfLoc, Adr2Pos(Adr1));

                Pos += 4; Adr += 4;
                if (Adr1 > lastAdr) lastAdr = Adr1;
            }
            if (Adr > lastAdr) lastAdr = Adr;
            curPos = Pos; curAdr = Adr;
            continue;
        }
//----------------------------------
//PosTry: xor reg, reg
//        push ebp
//        push offset @1
//        push fs:[reg]
//        mov fs:[reg], esp
//        ...
//@2:     ...
//At @1 we have various situations:
//----------------------------------
//@1:     jmp @HandleFinally
//        jmp @2
//----------------------------------
//@1:     jmp @HandleAnyException
//        call DoneExcept
//----------------------------------
//@1:     jmp HandleOnException
//        dd num
//Follow the table of num records like:
//        dd offset ExceptionInfo
//        dd offset ExceptionProc
//----------------------------------
        if (b1 == 0x68)		//try block	(push loc_TryBeg)
        {
            DWORD NPos = curPos + instrLen;
            //check that next instruction is push fs:[reg] or retn
            if ((Code[NPos] == 0x64 &&
                Code[NPos + 1] == 0xFF &&
                ((Code[NPos + 2] >= 0x30 && Code[NPos + 2] <= 0x37) || Code[NPos + 2] == 0x75)) ||
                Code[NPos] == 0xC3)
            {
                Adr = DisInfo.Immediate;      //Adr=@1
                if (IsValidCodeAdr(Adr))
                {
                    if (Adr > lastAdr) lastAdr = Adr;
                    Pos = Adr2Pos(Adr);
                    if (Pos >= 0 && Pos - NPos < MAX_DISASSEMBLE)
                    {
                        if (Code[Pos] == 0xE9) //jmp Handle...
                        {
                            //Disassemble jmp
                            instrLen1 = Disasm.Disassemble(Code + Pos, (__int64)Adr, &DisInfo, 0);

                            recN1 = GetInfoRec(DisInfo.Immediate);
                            if (recN1)
                            {
                                if (recN1->SameName("@HandleFinally"))
                                {
                                    //ret + jmp HandleFinally
                                    Pos += instrLen1; Adr += instrLen1;
                                    //jmp @2
                                    instrLen2 = Disasm.Disassemble(Code + Pos, (__int64)Adr, &DisInfo, 0);
                                    Adr += instrLen2;
                                    if (Adr > lastAdr) lastAdr = Adr;
                                }
                                else if (recN1->SameName("@HandleAnyException") || recN1->SameName("@HandleAutoException"))
                                {
                                    //jmp HandleAnyException
                                    Pos += instrLen1; Adr += instrLen1;
                                    //call DoneExcept
                                    instrLen2 = Disasm.Disassemble(Code + Pos, (__int64)Adr, 0, 0);
                                    Adr += instrLen2;
                                    if (Adr > lastAdr) lastAdr = Adr;
                                }
                                else if (recN1->SameName("@HandleOnException"))
                                {
                                    //jmp HandleOnException
                                    Pos += instrLen1; Adr += instrLen1;
                                    //dd num
                                    num = *((int*)(Code + Pos)); Pos += 4;
                                    if (Adr + 4 + 8 * num > lastAdr) lastAdr = Adr + 4 + 8 * num;

                                    for (int k = 0; k < num; k++)
                                    {
                                        //dd offset ExceptionInfo
                                        Pos += 4;
                                        //dd offset ExceptionProc
                                        Pos += 4;
                                    }
                                }
                            }
                        }
                    }
                }
            	curPos += instrLen; curAdr += instrLen;
            	continue;
            }
        }
        while (1)
        {
            //Call - stop analyze of arguments
            if (DisInfo.Call)
            {
                lastemb = false;
                Adr = DisInfo.Immediate;
                if (IsValidCodeAdr(Adr))
                {
                    recN1 = GetInfoRec(Adr);
                    if (recN1 && recN1->procInfo)
                    {
                        lastemb = (recN1->procInfo->flags & PF_EMBED);
                        WORD retb;
                        //@XStrCatN
                        if (recN1->SameName("@LStrCatN") ||
                            recN1->SameName("@WStrCatN") ||
                            recN1->SameName("@UStrCatN") ||
                            recN1->SameName("Format"))
                        {
                            retb = 0;
                        }
                        else
                            retb = recN1->procInfo->retBytes;

                        if (retb && sp >= retb)
                            sp -= retb;
                        else
                            sp = -1;
                    }
                    else
                        sp = -1;
                    //call not always preserve registers eax, edx, ecx
                    if (recN1)
                    {
                        //@IntOver, @BoundErr nothing change
                        if (!recN1->SameName("@IntOver") &&
                            !recN1->SameName("@BoundErr"))
                        {
                            argA = argD = argC = false;
                        }
                    }
                    else
                    {
                        argA = argD = argC = false;
                    }
                }
                else
                {
                    argA = argD = argC = false;
                    sp = -1;
                }
                break;
            }
            //jmp - stop analyze of output arguments
            if (op == OP_JMP)
            {
                lastCallAdr = 0;
                break;
            }
            //cop ..., [ebp + Offset]
            if (!kb && bpBased && DisInfo.BaseReg == 21 && DisInfo.IndxReg == -1 && (int)DisInfo.Offset > 0)
            {
                recN1 = GetInfoRec(fromAdr);
                //For embedded procs we have on1 additional argument (pushed on stack first), that poped from stack by instrcution pop ecx
                if (!emb || (int)DisInfo.Offset != retBytes + bpBase)
                {
                    int argSize = DisInfo.MemSize;
                    String argType = "";
                    if (argSize == 10) argType = "Extended";
                    //Each argument in stack has size 4*N bytes
                    if (argSize < 4) argSize = 4;
                    argSize = ((argSize + 3) / 4) * 4;
                    recN1->procInfo->AddArg(0x21, (int)DisInfo.Offset, argSize, "", argType);
                }
            }
            //Instruction pop reg always change reg
            if (op == OP_POP && DisInfo.OpType[0] == otREG)
            {
                //eax
                if (DisInfo.OpRegIdx[0] == 16)
                {
                    //Forget last call and set flag cfSkip, if it was call of embedded proc
                    if (lastCallAdr)
                    {
                        if (lastemb)
                        {
                            SetFlag(cfSkip, curPos);
                            lastemb = false;
                        }
                        lastCallAdr = 0;
                    }

                    if (argA && !inA)
                    {
                        argA = false;
                        if (!inD) argD = false;
                        if (!inC) argC = false;
                    }
                }
                //edx
                if (DisInfo.OpRegIdx[0] == 18)
                {
                    if (argD && !inD)
                    {
                        argD = false;
                        if (!inC) argC = false;
                    }
                }
                //ecx
                if (DisInfo.OpRegIdx[0] == 17)
                {
                    if (argC && !inC) argC = false;
                }
                break;
            }
            //cdq always change edx; eax may be output argument of last call
            if (op == OP_CDQ)
            {
                if (lastCallAdr)
                {
                    recN1 = GetInfoRec(lastCallAdr);
                    if (recN1 && recN1->procInfo &&
                        !(recN1->procInfo->flags & (PF_KBPROTO | PF_EVENT | PF_DYNAMIC)) &&
                        recN1->kind != ikConstructor && recN1->kind != ikDestructor)
                    {
                        recN1->procInfo->flags |= PF_OUTEAX;
                        recN1->kind = ikFunc;
                    }
                    lastCallAdr = 0;
                }
                if (argD && !inD)
                {
                    argD = false;
                    if (!inC) argC = false;
                }
                break;
            }
            if (DisInfo.Float)
            {
                //fstsw, fnstsw always change eax
                if (!memcmp(DisInfo.Mnem + 1, "stsw", 4) || !memcmp(DisInfo.Mnem + 1, "nstsw", 5))
                {
                    if (DisInfo.OpType[0] == otREG && (DisInfo.OpRegIdx[0] == 16 || DisInfo.OpRegIdx[0] == 8 || DisInfo.OpRegIdx[0] == 4 || DisInfo.OpRegIdx[0] == 0))
                    {
                        if (lastCallAdr) lastCallAdr = 0;

                        if (argA && !inA)
                        {
                            argA = false;
                            if (!inD) argD = false;
                            if (!inC) argC = false;
                        }
                    }
                    SetFlags(cfSkip, curPos, instrLen);
                    break;
                }
                //Instructions fst, fstp after call means that it was call of function
                if (!memcmp(DisInfo.Mnem + 1, "st", 2))
                {
                    Pos = GetNearestUpInstruction(curPos, fromPos, 1);
                    if (Pos != -1 && IsFlagSet(cfCall, Pos))
                    {
                        if (lastCallAdr)
                        {
                            recN1 = GetInfoRec(lastCallAdr);
                            if (recN1 && recN1->procInfo &&
                                !(recN1->procInfo->flags & (PF_KBPROTO | PF_EVENT | PF_DYNAMIC)) &&
                                recN1->kind != ikConstructor && recN1->kind != ikDestructor)
                            {
                                recN1->procInfo->flags |= PF_OUTEAX;
                                recN1->kind = ikFunc;
                            }
                            lastCallAdr = 0;
                        }
                    }
                    break;
                }
            }
    //mul, div ?????????????????????????????????????????????????????????????????????
            //xor reg, reg always change register
            if (op == OP_XOR && DisInfo.OpType[0] == DisInfo.OpType[1] && DisInfo.OpRegIdx[0] == DisInfo.OpRegIdx[1])
            {
                if (DisInfo.OpRegIdx[0] == 16 || DisInfo.OpRegIdx[0] == 8 || DisInfo.OpRegIdx[0] == 4 || DisInfo.OpRegIdx[0] == 0)
                {
                    if (lastCallAdr) lastCallAdr = 0;
                }
                if (DisInfo.OpRegIdx[0] == 18 || DisInfo.OpRegIdx[0] == 10 || DisInfo.OpRegIdx[0] == 6 || DisInfo.OpRegIdx[0] == 2)
                {
                    if (lastCallAdr) lastCallAdr = 0;
                }

                //eax, ax, ah, al
                if (DisInfo.OpRegIdx[0] == 16 || DisInfo.OpRegIdx[0] == 8 || DisInfo.OpRegIdx[0] == 4 || DisInfo.OpRegIdx[0] == 0)
                {
                    SetFlag(cfSetA, curPos);
                    if (argA && !inA)
                    {
                        argA = false;
                        if (!inD) argD = false;
                        if (!inC) argC = false;
                    }
                }
                //edx, dx, dh, dl
                if (DisInfo.OpRegIdx[0] == 18 || DisInfo.OpRegIdx[0] == 10 || DisInfo.OpRegIdx[0] == 6 || DisInfo.OpRegIdx[0] == 2)
                {
                    SetFlag(cfSetD, curPos);
                    if (argD && !inD)
                    {
                        argD = false;
                        if (!inC) argC = false;
                    }
                }
                //ecx, cx, ch, cl
                if (DisInfo.OpRegIdx[0] == 17 || DisInfo.OpRegIdx[0] == 9 || DisInfo.OpRegIdx[0] == 5 || DisInfo.OpRegIdx[0] == 1)
                {
                    SetFlag(cfSetC, curPos);
                    if (argC && !inC) argC = false;
                }
                break;
            }
            //If eax, edx, ecx in memory address - always used as registers
            if (DisInfo.BaseReg != -1 || DisInfo.IndxReg != -1)
            {
                if (DisInfo.BaseReg == 16 || DisInfo.IndxReg == 16)
                {
                    if (lastCallAdr)
                    {
                        recN1 = GetInfoRec(lastCallAdr);
                        if (recN1 && recN1->procInfo &&
                            !(recN1->procInfo->flags & (PF_KBPROTO | PF_EVENT | PF_DYNAMIC)) &&
                            recN1->kind != ikConstructor && recN1->kind != ikDestructor)
                        {
                            recN1->procInfo->flags |= PF_OUTEAX;
                            recN1->kind = ikFunc;
                        }
                        lastCallAdr = 0;
                    }
                }
                if (DisInfo.BaseReg == 16 || DisInfo.IndxReg == 16)
                {
                    if (argA && !inA)
                    {
                        inA = true;
                        argA = false;
                    }
                }
                if (DisInfo.BaseReg == 18 || DisInfo.IndxReg == 18)
                {
                    if (argD && !inD)
                    {
                        inD = true;
                        argD = false;
                        if (!inA)
                        {
                            inA = true;
                            argA = false;
                        }
                    }
                }
                if (DisInfo.BaseReg == 17 || DisInfo.IndxReg == 17)
                {
                    if (argC && !inC)
                    {
                        inC = true;
                        argC = false;
                        if (!inA)
                        {
                            inA = true;
                            argA = false;
                        }
                        if (!inD)
                        {
                            inD = true;
                            argD = false;
                        }
                    }
                }
            }
            //xchg
            if (op == OP_XCHG)
            {
                if (DisInfo.OpType[0] == otREG)
                {
                    if (DisInfo.OpRegIdx[0] == 16) //eax
                    {
                        if (lastCallAdr)
                        {
                            recN1 = GetInfoRec(lastCallAdr);
                            if (recN1 && recN1->procInfo &&
                                !(recN1->procInfo->flags & (PF_KBPROTO | PF_EVENT | PF_DYNAMIC)) &&
                                recN1->kind != ikConstructor && recN1->kind != ikDestructor)
                            {
                                recN1->procInfo->flags |= PF_OUTEAX;
                                recN1->kind = ikFunc;
                            }
                            lastCallAdr = 0;
                        }
                    }
                    if (DisInfo.OpRegIdx[0] == 16) //eax
                    {
                        SetFlag(cfSetA, curPos);
                        if (argA && !inA)
                        {
                            inA = true;
                            argA = false;
                        }
                    }
                    if (DisInfo.OpRegIdx[0] == 18) //edx
                    {
                        SetFlag(cfSetD, curPos);
                        if (argD && !inD)
                        {
                            inD = true;
                            argD = false;
                            if (!inA)
                            {
                                inA = true;
                                argA = false;
                            }
                        }
                    }
                    if (DisInfo.OpRegIdx[0] == 17) //ecx
                    {
                        SetFlag(cfSetC, curPos);
                        //xchg ecx, [ebp...] - ecx used as argument
                        if (DisInfo.BaseReg == 21)
                        {
                            inC = true;
                            argC = false;
                            if (!inA)
                            {
                                inA = true;
                                argA = false;
                            }
                            if (!inD)
                            {
                                inD = true;
                                argD = false;
                            }
                            //Set cfFrame upto start of procedure
                            SetFlags(cfFrame, fromPos, (curPos + instrLen - fromPos));
                        }
                        else if (argC && !inC)
                        {
                            inC = true;
                            argC = false;
                            if (!inA)
                            {
                                inA = true;
                                argA = false;
                            }
                            if (!inD)
                            {
                                inD = true;
                                argD = false;
                            }
                        }
                    }
                }
                if (DisInfo.OpType[1] == otREG)
                {
                    if (DisInfo.OpRegIdx[1] == 16)
                    {
                        if (lastCallAdr)
                        {
                            recN1 = GetInfoRec(lastCallAdr);
                            if (recN1 && recN1->procInfo &&
                                !(recN1->procInfo->flags & (PF_KBPROTO | PF_EVENT | PF_DYNAMIC)) &&
                                recN1->kind != ikConstructor && recN1->kind != ikDestructor)
                            {
                                recN1->procInfo->flags |= PF_OUTEAX;
                                recN1->kind = ikFunc;
                            }
                            lastCallAdr = 0;
                        }
                    }
                    if (DisInfo.OpRegIdx[1] == 16)
                    {
                        SetFlag(cfSetA, curPos);
                        if (argA && !inA)
                        {
                            inA = true;
                            argA = false;
                        }
                    }
                    if (DisInfo.OpRegIdx[1] == 18)
                    {
                        SetFlag(cfSetD, curPos);
                        if (argD && !inD)
                        {
                            inD = true;
                            argD = false;
                            if (!inA)
                            {
                                inA = true;
                                argA = false;
                            }
                        }
                    }
                    if (DisInfo.OpRegIdx[1] == 17)
                    {
                        SetFlag(cfSetC, curPos);
                        if (argC && !inC)
                        {
                            inC = true;
                            argC = false;
                            if (!inA)
                            {
                                inA = true;
                                argA = false;
                            }
                            if (!inD)
                            {
                                inD = true;
                                argD = false;
                            }
                        }
                    }
                }
                break;
            }
            //cop ..., reg
            if (DisInfo.OpType[1] == otREG)
            {
                if (DisInfo.OpRegIdx[1] == 16 || DisInfo.OpRegIdx[1] == 8 || DisInfo.OpRegIdx[1] == 0)
                {
                    if (lastCallAdr)
                    {
                        recN1 = GetInfoRec(lastCallAdr);
                        if (recN1 && recN1->procInfo &&
                            !(recN1->procInfo->flags & (PF_KBPROTO | PF_EVENT | PF_DYNAMIC)) &&
                            recN1->kind != ikConstructor && recN1->kind != ikDestructor)
                        {
                            recN1->procInfo->flags |= PF_OUTEAX;
                            recN1->kind = ikFunc;
                        }
                        lastCallAdr = 0;
                    }
                }
                //eax, ax, ah, al
                if (DisInfo.OpRegIdx[1] == 16 || DisInfo.OpRegIdx[1] == 8 || DisInfo.OpRegIdx[1] == 4 || DisInfo.OpRegIdx[1] == 0)
                {
                    if (argA && !inA)
                    {
                        inA = true;
                        argA = false;
                    }
                }
                //edx, dx, dh, dl
                if (DisInfo.OpRegIdx[1] == 18 || DisInfo.OpRegIdx[1] == 10 || DisInfo.OpRegIdx[1] == 6 || DisInfo.OpRegIdx[1] == 2)
                {
                    if (argD && !inD)
                    {
                        inD = true;
                        argD = false;
                        if (!inA)
                        {
                            inA = true;
                            argA = false;
                        }
                    }
                }
                //ecx, cx, ch, cl
                if (DisInfo.OpRegIdx[1] == 17 || DisInfo.OpRegIdx[1] == 9 || DisInfo.OpRegIdx[1] == 5 || DisInfo.OpRegIdx[1] == 1)
                {
                    if (argC && !inC)
                    {
                        inC = true;
                        argC = false;
                        if (!inA)
                        {
                            inA = true;
                            argA = false;
                        }
                        if (!inD)
                        {
                            inD = true;
                            argD = false;
                        }
                    }
                }
            }

            if (DisInfo.OpType[0] == otREG && op != OP_UNK && op != OP_PUSH)
            {
                if (op != OP_MOV && op != OP_LEA && op != OP_SET)
                {
                    //eax, ax, ah, al
                    if (DisInfo.OpRegIdx[0] == 16 || DisInfo.OpRegIdx[0] == 8 || DisInfo.OpRegIdx[0] == 4 || DisInfo.OpRegIdx[0] == 0)
                    {
                        if (argA && !inA)
                        {
                            inA = true;
                            argA = false;
                        }
                    }
                    //edx, dx, dh, dl
                    if (DisInfo.OpRegIdx[0] == 18 || DisInfo.OpRegIdx[0] == 10 || DisInfo.OpRegIdx[0] == 6 || DisInfo.OpRegIdx[0] == 2)
                    {
                        if (argD && !inD)
                        {
                            inD = true;
                            argD = false;
                            if (!inA)
                            {
                                inA = true;
                                argA = false;
                            }
                        }
                    }
                    //ecx, cx, ch, cl
                    if (DisInfo.OpRegIdx[0] == 17 || DisInfo.OpRegIdx[0] == 9 || DisInfo.OpRegIdx[0] == 5 || DisInfo.OpRegIdx[0] == 1)
                    {
                        if (argC && !inC)
                        {
                            inC = true;
                            argC = false;
                            if (!inA)
                            {
                                inA = true;
                                argA = false;
                            }
                            if (!inD)
                            {
                                inD = true;
                                argD = false;
                            }
                        }
                    }
                }
                else
                {
                    //eax, ax, ah, al
                    if (DisInfo.OpRegIdx[0] == 16 || DisInfo.OpRegIdx[0] == 8 || DisInfo.OpRegIdx[0] == 4 || DisInfo.OpRegIdx[0] == 0)
                    {
                        SetFlag(cfSetA, curPos);
                        if (argA && !inA)
                        {
                            argA = false;
                            if (!inD) argD = false;
                            if (!inC) argC = false;
                        }
                        if (lastCallAdr) lastCallAdr = 0;
                    }
                    //edx, dx, dh, dl
                    if (DisInfo.OpRegIdx[0] == 18 || DisInfo.OpRegIdx[0] == 10 || DisInfo.OpRegIdx[0] == 6 || DisInfo.OpRegIdx[0] == 2)
                    {
                        SetFlag(cfSetD, curPos);
                        if (argD && !inD)
                        {
                            argD = false;
                            if (!inC) argC = false;
                        }
                        if (lastCallAdr) lastCallAdr = 0;
                    }
                    //ecx, cx, ch, cl
                    if (DisInfo.OpRegIdx[0] == 17 || DisInfo.OpRegIdx[0] == 9 || DisInfo.OpRegIdx[0] == 5 || DisInfo.OpRegIdx[0] == 1)
                    {
                        SetFlag(cfSetC, curPos);
                        if (argC && !inC) argC = false;
                    }
                }
            }
            break;
        }

        if (DisInfo.Call)  //call sub_XXXXXXXX
        {
            lastCallAdr = 0;
            Adr = DisInfo.Immediate;
            if (IsValidCodeAdr(Adr))
            {
                retType = AnalyzeArguments(Adr);
                lastCallAdr = Adr;

                recN1 = GetInfoRec(Adr);
                if (recN1 && recN1->HasName())
                {
                    //Hide some procedures
                    //@Halt0 is not executed
                    if (recN1->SameName("@Halt0"))
                    {
                        SetFlags(cfSkip, curPos, instrLen);
                        if (fromAdr == EP && !lastAdr) break;
                    }
                    //Procs together previous unstruction
                    else if (recN1->SameName("@IntOver")     ||
                             recN1->SameName("@InitImports") ||
                             recN1->SameName("@InitResStringImports"))
                    {
                        Pos = GetNearestUpInstruction(curPos, fromPos, 1);
                        if (Pos != -1) SetFlags(cfSkip, Pos, (curPos - Pos) + instrLen);
                    }
                    //@BoundErr
                    else if (recN1->SameName("@BoundErr"))
                    {
                    	if (IsFlagSet(cfLoc, curPos))
                        {
                            Pos = GetNearestUpInstruction(curPos, fromPos, 1);
                            Disasm.Disassemble(Code + Pos, (__int64)Pos2Adr(Pos), &DisInfo1, 0);
                            if (DisInfo1.Branch)
                            {
                            	Pos = GetNearestUpInstruction(Pos, fromPos, 3);
                                SetFlags(cfSkip, Pos, (curPos - Pos) + instrLen);
                            }
                        }
                        else
                        {
                            Pos = GetNearestUpInstruction(curPos, fromPos, 1);
                            Disasm.Disassemble(Code + Pos, (__int64)Pos2Adr(Pos), &DisInfo1, 0);
                            if (DisInfo1.Branch)
                            {
                                Pos = GetNearestUpInstruction(Pos, fromPos, 1);
                                if (IsFlagSet(cfPop, Pos))
                                {
                                 	Pos = GetNearestUpInstruction(Pos, fromPos, 3);
                                }
                              	SetFlags(cfSkip, Pos, (curPos - Pos) + instrLen);
                            }
                        }
                    }
                    //Not in source code
                    else if (recN1->SameName("@_IOTest") ||
                             recN1->SameName("@InitExe") ||
                             recN1->SameName("@InitLib") ||
                    		 recN1->SameName("@DoneExcept"))
                    {
                        SetFlags(cfSkip, curPos, instrLen);
                    }
                }
            }
            curPos += instrLen; curAdr += instrLen;
            continue;
        }

        if (b1 == 0xEB ||				 //short relative abs jmp or cond jmp
        	(b1 >= 0x70 && b1 <= 0x7F) ||
            (b1 == 0xF && b2 >= 0x80 && b2 <= 0x8F))
        {
            Adr = DisInfo.Immediate;
            if (IsValidCodeAdr(Adr))
            {
                if (Adr >= fromAdr && Adr > lastAdr) lastAdr = Adr;
            }
            curPos += instrLen; curAdr += instrLen;
            continue;
        }
        if (b1 == 0xE9)    //relative abs jmp or cond jmp
        {
            Adr = DisInfo.Immediate;
            if (IsValidCodeAdr(Adr))
            {
                recN1 = GetInfoRec(Adr);
                if (!recN1 && Adr >= fromAdr && Adr > lastAdr) lastAdr = Adr;
            }
            curPos += instrLen; curAdr += instrLen;
            continue;
        }
        curPos += instrLen; curAdr += instrLen;
    }
    //Check matching ret bytes and summary size of stack arguments
    if (bpBased)
    {
        if (recN->procInfo->args)
        {
            int delta = retBytes;
            for (int n = 0; n < recN->procInfo->args->Count; n++)
            {
                argInfo = (PARGINFO)recN->procInfo->args->Items[n];
                if (argInfo->Ndx > 2) delta -= argInfo->Size;
            }
            if (delta < 0)
            {
            	//If delta between N bytes (in "ret N" instruction) and total size of argumnets != 0
                recN->procInfo->flags |= PF_ARGSIZEG;
                //delta = 4 and proc can be embbedded - allow that it really embedded
                if (delta == 4 && (recN->procInfo->flags & PF_MAYBEEMBED))
                {
                	//Ставим флажок PF_EMBED
                    recN->procInfo->flags |= PF_EMBED;
                    //Skip following after call instrcution "pop ecx"
                    for (int n = 0; n < recN->xrefs->Count; n++)
                    {
                    	PXrefRec recX = (PXrefRec)recN->xrefs->Items[n];
                        if (recX->type == 'C')
                        {
                        	Adr = recX->adr + recX->offset; Pos = Adr2Pos(Adr);
                    		instrLen = Disasm.Disassemble(Code + Pos, (__int64)Adr, &DisInfo, 0);
                    		Pos += instrLen;
                    		if (Code[Pos] == 0x59) SetFlag(cfSkip, Pos);
                        }
                    }
                }
            }
            //If delta < 0, then part of arguments can be unusable
            else if (delta < 0)
            {
            	recN->procInfo->flags |= PF_ARGSIZEL;
            }
        }
    }
    recN = GetInfoRec(fromAdr);
    //if PF_OUTEAX not set - Procedure
    if (!kb && !(recN->procInfo->flags & PF_OUTEAX))
    {
        if (recN->kind != ikConstructor && recN->kind != ikDestructor)
        {
            recN->kind = ikProc;
        }
    }

    recN->procInfo->stackSize = procStackSize + 0x1000;
    if (lastCallAdr) return retType;
    return "";
}
Beispiel #14
0
void
HTMLAnchorElement::OnDNSPrefetchDeferred()
{
  UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
  SetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
}
Beispiel #15
0
// private
Cvar::Cvar() {
	cvars[name] = this;

	SetFlags( CVAR_NONE );
	modified = false;
}
void CAchievement_AchievedCount::Init() 
{
	SetFlags( ACH_SAVE_GLOBAL );
	SetGoal( 1 );
	SetAchievementsRequired( 0, 0, 0 );
}
void CLightning::BeamUpdateVars( void )
{
	int beamType;
	int pointStart, pointEnd;

	edict_t *pStart = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(m_iszStartEntity) );
	edict_t *pEnd = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(m_iszEndEntity) );
	pointStart = IsPointEntity( CBaseEntity::Instance(pStart) );
	pointEnd = IsPointEntity( CBaseEntity::Instance(pEnd) );

	pev->skin = 0;
	pev->sequence = 0;
	pev->rendermode = 0;
	pev->flags |= FL_CUSTOMENTITY;
	pev->model = m_iszSpriteName;
	SetTexture( m_spriteTexture );

	beamType = BEAM_ENTS;
	if ( pointStart || pointEnd )
	{
		if ( !pointStart )	// One point entity must be in pStart
		{
			edict_t *pTemp;
			// Swap start & end
			pTemp = pStart;
			pStart = pEnd;
			pEnd = pTemp;
			int swap = pointStart;
			pointStart = pointEnd;
			pointEnd = swap;
		}
		if ( !pointEnd )
			beamType = BEAM_ENTPOINT;
		else
			beamType = BEAM_POINTS;
	}

	SetType( beamType );
	if ( beamType == BEAM_POINTS || beamType == BEAM_ENTPOINT || beamType == BEAM_HOSE )
	{
		SetStartPos( pStart->v.origin );
		if ( beamType == BEAM_POINTS || beamType == BEAM_HOSE )
			SetEndPos( pEnd->v.origin );
		else
			SetEndEntity( ENTINDEX(pEnd) );
	}
	else
	{
		SetStartEntity( ENTINDEX(pStart) );
		SetEndEntity( ENTINDEX(pEnd) );
	}

	RelinkBeam();

	SetWidth( m_boltWidth );
	SetNoise( m_noiseAmplitude );
	SetFrame( m_frameStart );
	SetScrollRate( m_speed );
	if ( pev->spawnflags & SF_BEAM_SHADEIN )
		SetFlags( BEAM_FSHADEIN );
	else if ( pev->spawnflags & SF_BEAM_SHADEOUT )
		SetFlags( BEAM_FSHADEOUT );
}
Beispiel #18
0
bool RARExecuteProgram(RARVirtualMachine *vm, RARProgram *prog)
{
    RAROpcode *opcode = prog->opcodes;
    uint32_t flags = 0;
    uint32_t op1, op2, carry, i;
    uint32_t counter = 0;

    if (!RARIsProgramTerminated(prog))
        return false;

    while ((uint32_t)(opcode - prog->opcodes) < prog->length && counter++ < RARRuntimeMaxInstructions) {
        switch (opcode->instruction) {
        case RARMovInstruction:
            SetOperand1(GetOperand2());
            NextInstruction();

        case RARCmpInstruction:
            op1 = GetOperand1();
            SetFlagsWithCarry(op1 - GetOperand2(), result > op1);
            NextInstruction();

        case RARAddInstruction:
            op1 = GetOperand1();
            if (opcode->bytemode)
                SetOperand1AndByteFlagsWithCarry((op1 + GetOperand2()) & 0xFF, result < op1);
            else
                SetOperand1AndFlagsWithCarry(op1 + GetOperand2(), result < op1);
            NextInstruction();

        case RARSubInstruction:
            op1 = GetOperand1();
#if 0 /* apparently not correctly implemented in the RAR VM */
            if (opcode->bytemode)
                SetOperand1AndByteFlagsWithCarry((op1 - GetOperand2()) & 0xFF, result > op1);
            else
#endif
            SetOperand1AndFlagsWithCarry(op1 - GetOperand2(), result > op1);
            NextInstruction();

        case RARJzInstruction:
            if ((flags & ZeroFlag))
                Jump(GetOperand1());
            NextInstruction();

        case RARJnzInstruction:
            if (!(flags & ZeroFlag))
                Jump(GetOperand1());
            NextInstruction();

        case RARIncInstruction:
            if (opcode->bytemode)
                SetOperand1AndFlags((GetOperand1() + 1) & 0xFF);
            else
                SetOperand1AndFlags(GetOperand1() + 1);
            NextInstruction();

        case RARDecInstruction:
            if (opcode->bytemode)
                SetOperand1AndFlags((GetOperand1() - 1) & 0xFF);
            else
                SetOperand1AndFlags(GetOperand1() - 1);
            NextInstruction();

        case RARJmpInstruction:
            Jump(GetOperand1());

        case RARXorInstruction:
            SetOperand1AndFlags(GetOperand1() ^ GetOperand2());
            NextInstruction();

        case RARAndInstruction:
            SetOperand1AndFlags(GetOperand1() & GetOperand2());
            NextInstruction();

        case RAROrInstruction:
            SetOperand1AndFlags(GetOperand1() | GetOperand2());
            NextInstruction();

        case RARTestInstruction:
            SetFlags(GetOperand1() & GetOperand2());
            NextInstruction();

        case RARJsInstruction:
            if ((flags & SignFlag))
                Jump(GetOperand1());
            NextInstruction();

        case RARJnsInstruction:
            if (!(flags & SignFlag))
                Jump(GetOperand1());
            NextInstruction();

        case RARJbInstruction:
            if ((flags & CarryFlag))
                Jump(GetOperand1());
            NextInstruction();

        case RARJbeInstruction:
            if ((flags & (CarryFlag | ZeroFlag)))
                Jump(GetOperand1());
            NextInstruction();

        case RARJaInstruction:
            if (!(flags & (CarryFlag | ZeroFlag)))
                Jump(GetOperand1());
            NextInstruction();

        case RARJaeInstruction:
            if (!(flags & CarryFlag))
                Jump(GetOperand1());
            NextInstruction();

        case RARPushInstruction:
            vm->registers[7] -= 4;
            RARVirtualMachineWrite32(vm, vm->registers[7], GetOperand1());
            NextInstruction();

        case RARPopInstruction:
            SetOperand1(RARVirtualMachineRead32(vm, vm->registers[7]));
            vm->registers[7] += 4;
            NextInstruction();

        case RARCallInstruction:
            vm->registers[7] -= 4;
            RARVirtualMachineWrite32(vm, vm->registers[7], (uint32_t)(opcode - prog->opcodes + 1));
            Jump(GetOperand1());

        case RARRetInstruction:
            if (vm->registers[7] >= RARProgramMemorySize)
                return true;
            i = RARVirtualMachineRead32(vm, vm->registers[7]);
            vm->registers[7] += 4;
            Jump(i);

        case RARNotInstruction:
            SetOperand1(~GetOperand1());
            NextInstruction();

        case RARShlInstruction:
            op1 = GetOperand1();
            op2 = GetOperand2();
            SetOperand1AndFlagsWithCarry(op1 << op2, ((op1 << (op2 - 1)) & 0x80000000) != 0);
            NextInstruction();

        case RARShrInstruction:
            op1 = GetOperand1();
            op2 = GetOperand2();
            SetOperand1AndFlagsWithCarry(op1 >> op2, ((op1 >> (op2 - 1)) & 1) != 0);
            NextInstruction();

        case RARSarInstruction:
            op1 = GetOperand1();
            op2 = GetOperand2();
            SetOperand1AndFlagsWithCarry(((int32_t)op1) >> op2, ((op1 >> (op2 - 1)) & 1) != 0);
            NextInstruction();

        case RARNegInstruction:
            SetOperand1AndFlagsWithCarry(-(int32_t)GetOperand1(), result != 0);
            NextInstruction();

        case RARPushaInstruction:
            vm->registers[7] -= 32;
            for (i = 0; i < 8; i++)
                RARVirtualMachineWrite32(vm, vm->registers[7] + (7 - i) * 4, vm->registers[i]);
            NextInstruction();

        case RARPopaInstruction:
            for (i = 0; i < 8; i++)
                vm->registers[i] = RARVirtualMachineRead32(vm, vm->registers[7] + (7 - i) * 4);
            vm->registers[7] += 32;
            NextInstruction();

        case RARPushfInstruction:
            vm->registers[7] -= 4;
            RARVirtualMachineWrite32(vm, vm->registers[7], flags);
            NextInstruction();

        case RARPopfInstruction:
            flags = RARVirtualMachineRead32(vm, vm->registers[7]);
            vm->registers[7] += 4;
            NextInstruction();

        case RARMovzxInstruction:
            SetOperand1(GetOperand2());
            NextInstruction();

        case RARMovsxInstruction:
            SetOperand1(SignExtend(GetOperand2()));
            NextInstruction();

        case RARXchgInstruction:
            op1 = GetOperand1();
            op2 = GetOperand2();
            SetOperand1(op2);
            SetOperand2(op1);
            NextInstruction();

        case RARMulInstruction:
            SetOperand1(GetOperand1() * GetOperand2());
            NextInstruction();

        case RARDivInstruction:
            op2 = GetOperand2();
            if (op2 != 0)
                SetOperand1(GetOperand1() / op2);
            NextInstruction();

        case RARAdcInstruction:
            op1 = GetOperand1();
            carry = (flags & CarryFlag);
            if (opcode->bytemode)
                SetOperand1AndFlagsWithCarry((op1 + GetOperand2() + carry) & 0xFF, result < op1 || (result == op1 && carry)); /* does not correctly set sign bit */
            else
                SetOperand1AndFlagsWithCarry(op1 + GetOperand2() + carry, result < op1 || (result == op1 && carry));
            NextInstruction();

        case RARSbbInstruction:
            op1 = GetOperand1();
            carry = (flags & CarryFlag);
            if (opcode->bytemode)
                SetOperand1AndFlagsWithCarry((op1 - GetOperand2() - carry) & 0xFF, result > op1 || (result == op1 && carry)); /* does not correctly set sign bit */
            else
                SetOperand1AndFlagsWithCarry(op1 - GetOperand2() - carry, result > op1 || (result == op1 && carry));
            NextInstruction();

        case RARPrintInstruction:
            /* TODO: ??? */
            NextInstruction();
        }
    }

    return false;
}
Beispiel #19
0
ToolbarView::ToolbarView()
	: BGroupView(B_HORIZONTAL, 5)
{
	SetFlags(Flags() | B_WILL_DRAW);
	SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
}
Beispiel #20
0
DebugDraw::DebugDraw() {
	window.create(sf::VideoMode(800, 600), "Imaginecup");
	SetFlags(e_shapeBit);
}
void UCurveBase::MakeTransactional() 
{
	SetFlags(GetFlags() | RF_Transactional);
}
void C_ServerItem::SetDefaultFlags()
{
	SetFlags(DefaultFlags_);
}
Beispiel #23
0
void HTMLLinkElement::OnDNSPrefetchDeferred() {
  UnsetFlags(HTML_LINK_DNS_PREFETCH_REQUESTED);
  SetFlags(HTML_LINK_DNS_PREFETCH_DEFERRED);
}
void
EBePrivateWin::DispatchMessage(BMessage *bMsg, BHandler *handler)
{
	bool handled = true;

	if(bMsg->what == 'etk_')
	{
		int32 what = 0;
		bMsg->FindInt32("etk:what", &what);

		switch(what)
		{
			case ETK_BEOS_QUIT:
				doQuit = true;
				PostMessage(B_QUIT_REQUESTED);
				break;

			case ETK_BEOS_CONTACT_TO:
				{
					fContactor = EMessenger();
					const char *buffer = NULL;
					ssize_t size = -1;
					if(bMsg->FindData("etk:messenger", B_ANY_TYPE, (const void**)&buffer, &size) != B_OK) break;
					if(buffer == NULL || size <= 0) break;
					fContactor.Unflatten(buffer, (size_t)size);
				}
				break;

			case ETK_BEOS_SET_BACKGROUND:
				{
					rgb_color bkColor;
					if(bMsg->FindInt32("background", (int32*)&bkColor) != B_OK) break;
					fTopView->SetViewColor(bkColor);
					fTopView->Invalidate();
				}
				break;

			case ETK_BEOS_SET_LOOK:
				{
					int8 look;
					if(bMsg->FindInt8("look", &look) != B_OK) break;
					switch((e_window_look)look)
					{
						case E_BORDERED_WINDOW_LOOK:
							SetLook(B_BORDERED_WINDOW_LOOK);
							break;

						case E_NO_BORDER_WINDOW_LOOK:
							SetLook(B_NO_BORDER_WINDOW_LOOK);
							break;

						case E_TITLED_WINDOW_LOOK:
							SetLook(B_TITLED_WINDOW_LOOK);
							break;

						case E_DOCUMENT_WINDOW_LOOK:
							SetLook(B_DOCUMENT_WINDOW_LOOK);
							break;

						case E_MODAL_WINDOW_LOOK:
							SetLook(B_MODAL_WINDOW_LOOK);
							break;

						case E_FLOATING_WINDOW_LOOK:
							SetLook(B_FLOATING_WINDOW_LOOK);
							break;

						default:
							break;
					}
				}
				break;

			case ETK_BEOS_SET_TITLE:
				{
					const char *title = NULL;
					if(bMsg->FindString("title", &title) != B_OK) break;
					SetTitle(title);
				}
				break;

			case ETK_BEOS_SET_WORKSPACES:
				{
					uint32 workspaces = 0;
					if(bMsg->FindInt32("workspaces", (int32*)&workspaces) != B_OK) break;
					if(workspaces == 0) workspaces = current_workspace() + 1;
					SetWorkspaces(workspaces);
				}
				break;

			case ETK_BEOS_GET_WORKSPACES:
				{
					uint32 workspaces = Workspaces();
					bMsg->AddInt32("workspaces", *((int32*)&workspaces));
				}
				break;

			case ETK_BEOS_ICONIFY:
				if(!IsMinimized()) Minimize(true);
				break;

			case ETK_BEOS_SHOW:
				if(IsHidden())
				{
					uint32 oldFlags = Flags();
					SetFlags(oldFlags | B_AVOID_FOCUS);
					Show();
					if(Look() != B_NO_BORDER_WINDOW_LOOK) SetFlags(oldFlags);
				}
				break;

			case ETK_BEOS_HIDE:
				if(!IsHidden()) Hide();
				break;

			case ETK_BEOS_RAISE:
				if(!IsFront())
				{
					uint32 oldFlags = Flags();
					SetFlags(oldFlags | B_AVOID_FOCUS);
					Activate(true);
					if(Look() != B_NO_BORDER_WINDOW_LOOK) SetFlags(oldFlags);
				}
				break;

			case ETK_BEOS_LOWER:
				{
					BHandler *_frontWin = NULL;
					if(bMsg->FindPointer("front", (void**)&_frontWin) != B_OK) break;
					BWindow *frontWin = e_cast_as(_frontWin, BWindow);
					if(frontWin == NULL) break;
					SendBehind(frontWin);
					bMsg->AddBool("done", true);
				}
				break;

			case ETK_BEOS_ACTIVATE:
				{
					bool state;
					if(bMsg->FindBool("state", &state) != B_OK || state == IsActive()) break;
					Activate(state);
				}
				break;

			case ETK_BEOS_GET_ACTIVATED_STATE:
				bMsg->AddBool("state", IsActive());
				break;

			case ETK_BEOS_MOVE_RESIZE:
				{
					if(bMsg->HasPoint("where"))
					{
						BPoint pt;
						if(bMsg->FindPoint("where", &pt) == B_OK) MoveTo(pt);
					}

					if(bMsg->HasFloat("width") && bMsg->HasFloat("height"))
					{
						float w = -1, h = -1;
						bMsg->FindFloat("width", &w);
						bMsg->FindFloat("height", &h);
						if(w < 0 || h < 0) break;
						ResizeTo(w, h);
					}
				}
				break;

			case ETK_BEOS_DRAW_BITMAP:
				{
					BBitmap *bitmap = NULL;
					BRect srcRect, destRect;
					const ERegion *clipping = NULL;

					if(bMsg->FindPointer("bitmap", (void**)&bitmap) != B_OK || bitmap == NULL) break;
					bMsg->FindRect("src", &srcRect);
					bMsg->FindRect("dest", &destRect);
					if(srcRect.IsValid() == false || destRect.IsValid() == false) break;
					bMsg->FindPointer("clipping", (void**)&clipping); 

					BRegion beRegion;
					__etk_convert_region(clipping, &beRegion, fTopView->Bounds());
					fTopView->ConstrainClippingRegion(&beRegion);
					fTopView->DrawBitmap(bitmap, srcRect, destRect);
				}
				break;

			case ETK_BEOS_GRAB_MOUSE:
			case ETK_BEOS_UNGRAB_MOUSE:
				{
					uint32 options = (what == ETK_BEOS_GRAB_MOUSE ? B_LOCK_WINDOW_FOCUS : 0);
					if(fTopView->SetEventMask(B_POINTER_EVENTS, options) != B_OK) break;
					bMsg->AddBool("state", what == ETK_BEOS_GRAB_MOUSE);
				}
				break;

			case ETK_BEOS_GRAB_KEYBOARD:
			case ETK_BEOS_UNGRAB_KEYBOARD:
				{
					uint32 options = (what == ETK_BEOS_GRAB_KEYBOARD ? B_LOCK_WINDOW_FOCUS : 0);
					if(fTopView->SetEventMask(B_KEYBOARD_EVENTS, options) != B_OK) break;
					bMsg->AddBool("state", what == ETK_BEOS_GRAB_KEYBOARD);
				}
				break;

			case ETK_BEOS_QUERY_MOUSE:
				{
					BPoint pt;
					uint32 btns = 0;
					fTopView->GetMouse(&pt, &btns, false);
					bMsg->AddInt32("x", (int32)pt.x);
					bMsg->AddInt32("y", (int32)pt.y);
					bMsg->AddInt32("buttons", (int32)btns);
				}
				break;

			case ETK_BEOS_SET_SIZE_LIMITS:
				{
					BRect r;
					if(bMsg->FindRect("limits", &r) != B_OK) break;
					SetSizeLimits(r.left, r.right, r.top, r.bottom);
					bMsg->AddBool("done", true);
				}
				break;

			case ETK_BEOS_GET_SIZE_LIMITS:
				{
					BRect r(-1, -1, -1, -1);
					GetSizeLimits(&(r.left), &(r.right), &(r.top), &(r.bottom));
					bMsg->AddRect("limits", r);
				}
				break;

			default:
				handled = false;
				break;
		}

		if(handled)
		{
			BMessage aMsg(*bMsg);
			bMsg->SendReply(&aMsg);
			return;
		}
	}

	switch(bMsg->what)
	{
		case B_WINDOW_ACTIVATED:
			{
				handled = false;

				if(fContactor.IsValid() == false) break;
				EMessage message(E_WINDOW_ACTIVATED);
				message.AddBool("etk:msg_from_gui", true);
				message.AddInt64("when", e_real_time_clock_usecs());
				fContactor.SendMessage(&message);
			}
			break;

		case B_MOUSE_DOWN:
		case B_MOUSE_UP:
		case B_MOUSE_MOVED:
			{
				if(fContactor.IsValid() == false) break;

				BPoint where;
				int32 buttons = 0;

				bMsg->FindPoint("where", &where);
				if(bMsg->what != B_MOUSE_UP) bMsg->FindInt32("buttons", &buttons);

				int32 clicks = 1;
				if(bMsg->what == B_MOUSE_DOWN)
				{
#if 0
					bMsg->FindInt32("clicks", &clicks);
#else
					bigtime_t eventTime;
					if(bMsg->FindInt64("when", &eventTime) == B_OK)
					{
						if(eventTime - fPrevMouseDownTime <= CLICK_TIMEOUT)
							clicks = (fPrevMouseDownCount += 1);
						else
							clicks = fPrevMouseDownCount = 1;
						fPrevMouseDownTime = eventTime;
					}
#endif
				}

				EMessage message;
				if(bMsg->what == B_MOUSE_DOWN) message.what = E_MOUSE_DOWN;
				else if(bMsg->what == B_MOUSE_UP) message.what = E_MOUSE_UP;
				else message.what = E_MOUSE_MOVED;

				message.AddBool("etk:msg_from_gui", true);
				message.AddInt64("when", e_real_time_clock_usecs());
				if(bMsg->what != B_MOUSE_UP) message.AddInt32("buttons", buttons);
				if(bMsg->what == B_MOUSE_DOWN) message.AddInt32("clicks", clicks);
				message.AddPoint("where", EPoint(where.x, where.y));
				ConvertToScreen(&where);
				message.AddPoint("screen_where", EPoint(where.x, where.y));

				// TODO: modifiers

				message.AddMessenger("etk:msg_for_target", fContactor);

				etk_app->PostMessage(&message);
			}
			break;

		case B_KEY_DOWN:
		case B_KEY_UP:
		case B_UNMAPPED_KEY_DOWN:
		case B_UNMAPPED_KEY_UP:
			{
				if(fContactor.IsValid() == false) break;

				int8 byte[4];
				const char *bytes = NULL;
				int32 numBytes = 0;
				int32 key = 0;
				int32 key_repeat = 0;
				int32 beModifiers = 0;
				eint32 modifiers = 0;

				bMsg->FindInt32("key", &key);
				bMsg->FindInt32("modifiers", &beModifiers);
				bzero(byte, sizeof(int8) * 4);

				if(bMsg->what == B_KEY_DOWN || bMsg->what == B_KEY_UP)
				{
					for(int32 i = 0; i < 3; i++) bMsg->FindInt8("byte", i, &byte[i]);
					if(bMsg->FindString("bytes", &bytes) == B_OK) numBytes = strlen(bytes);
//					if(bMsg->what == B_KEY_DOWN) bMsg->FindInt32("be:key_repeat", &key_repeat);
				}
				else
				{
					etk_beos_get_byte(beModifiers, key, (char*)byte);
				}

				if(beModifiers & B_SHIFT_KEY) modifiers |= E_SHIFT_KEY;
				if(beModifiers & B_CONTROL_KEY) modifiers |= E_CONTROL_KEY;
				if(beModifiers & B_COMMAND_KEY) modifiers |= E_COMMAND_KEY;

				EMessage message;
				if(bMsg->what == B_KEY_DOWN) message.what = E_KEY_DOWN;
				else if(bMsg->what == B_KEY_UP) message.what = E_KEY_UP;
				else if(bMsg->what == B_UNMAPPED_KEY_DOWN) message.what = E_UNMAPPED_KEY_DOWN;
				else message.what = E_UNMAPPED_KEY_UP;

				message.AddBool("etk:msg_from_gui", true);
				message.AddInt64("when", e_real_time_clock_usecs());
				message.AddInt32("key", key);
				message.AddInt32("modifiers", modifiers);

				if(bMsg->what == B_KEY_DOWN || bMsg->what == B_KEY_UP)
				{
					if(bMsg->what == B_KEY_DOWN) message.AddInt32("etk:key_repeat", key_repeat);
					for(int32 i = 0; i < 3; i++) message.AddInt8("byte", byte[i]);
					if(!(numBytes != 1 || *bytes != byte[0]))
					{
						etk_beos_get_byte(beModifiers, key, (char*)byte);
						message.AddString("bytes", (char*)byte);
					}
					else if(numBytes > 0)
					{
						message.AddString("bytes", bytes);
					}
				}
				else if(byte[0] != 0)
				{
					message.AddInt8("byte", byte[0]);
					message.AddString("bytes", (char*)byte);
				}

				message.AddMessenger("etk:msg_for_target", fContactor);

				etk_app->PostMessage(&message);
			}
			break;

		case B_MODIFIERS_CHANGED:
			{
				if(fContactor.IsValid() == false) break;

				eint32 modifiers = 0;
				eint32 old_modifiers = 0;
				int32 beModifiers = 0;
				int32 old_beModifiers = 0;

				bMsg->FindInt32("modifiers", &beModifiers);
				bMsg->FindInt32("be:old_modifiers", &old_beModifiers);

				if(beModifiers & B_SHIFT_KEY) modifiers |= E_SHIFT_KEY;
				if(beModifiers & B_CONTROL_KEY) modifiers |= E_CONTROL_KEY;
				if(beModifiers & B_COMMAND_KEY) modifiers |= E_COMMAND_KEY;

				if(old_beModifiers & B_SHIFT_KEY) old_modifiers |= E_SHIFT_KEY;
				if(old_beModifiers & B_CONTROL_KEY) old_modifiers |= E_CONTROL_KEY;
				if(old_beModifiers & B_COMMAND_KEY) old_modifiers |= E_COMMAND_KEY;

				EMessage message(E_MODIFIERS_CHANGED);

				message.AddBool("etk:msg_from_gui", true);
				message.AddInt64("when", e_real_time_clock_usecs());
				message.AddInt32("modifiers", modifiers);
				message.AddInt32("etk:old_modifiers", old_modifiers);

				message.AddMessenger("etk:msg_for_target", fContactor);

				etk_app->PostMessage(&message);
			}
			break;

		default:
			handled = false;
			break;
	}

	if(!handled) BWindow::DispatchMessage(bMsg, handler);
}
Beispiel #25
0
static char *GetOP( BYTE Num )
  {
    SetFlags( op_flags[ Num ] );
 return opmap1[Num];
}
Beispiel #26
0
MEMORY::MEMORY()
	: BWindow(rect, "Aural illusion - Memory Setup", B_TITLED_WINDOW, B_CURRENT_WORKSPACE)
{
	BView* memoryview = new BView(BRect(0,0,210,160),"memoryview", B_FOLLOW_ALL, B_WILL_DRAW);

	memoryview->SetViewColor(216,216,216); // View is Grey
	memoryview->SetHighColor(255,255,255);
	memoryview->SetLowColor(0,0,0);

	memlev = new BSlider(BRect(3,3,200,53), "memlev", "Memory Size",  new BMessage(MEM_LEV), 0,100);
	memlev->SetHashMarks(B_HASH_MARKS_BOTH);
	memlev->SetHashMarkCount(9);
	memlev->SetLimitLabels("Min", "Max");
	memlev->SetValue(0);
	memoryview->AddChild(memlev);

	// View for Radio Buttons
	BView* memtypview = new BView(BRect(145,65,210,135), "memtypview", B_FOLLOW_ALL, B_WILL_DRAW);
	
	small = new BRadioButton(BRect(0,0,65,15),"small","Small",			new BMessage(MEM_SMALL));
	small->SetValue(1); // default is small
	memtypview->AddChild(small);

	medium = new BRadioButton(BRect(0,16,65,29),"medium","Medium",		new BMessage(MEM_MEDIUM));
	memtypview->AddChild(medium);

	large = new BRadioButton(BRect(0,32,65,33),"large","Large",		new BMessage(MEM_LARGE));
	memtypview->AddChild(large);

	memtypview->SetViewColor(216,216,216);
	memoryview->AddChild(memtypview);

	// OK Button
	memok = new BButton(BRect(80,130,130,150), "ok", "OK",	new BMessage(MEM_OK));
	memok->MakeDefault(1); // set as default for fancy surround
	memok->SetFont(be_bold_font);
	memoryview->AddChild(memok);

	// memory display string
	memstring = new BStringView(BRect(5,70,144,84), "memstring"," ",  B_WILL_DRAW);
	memstring->SetFont(be_bold_font);
	memstring->SetHighColor(0,0,0); // text to Black
	memoryview->AddChild(memstring);

	// Time display string
	timestring = new BStringView(BRect(5,85,144,100), "timestring"," ",  B_WILL_DRAW);
	timestring->SetFont(be_bold_font);
	timestring->SetHighColor(0,0,0); // text to Black
	memoryview->AddChild(timestring);

	// KHz string
	kstring = new BStringView(BRect(5,101,144,116), "kstring","at 44KHz Mono",  B_WILL_DRAW);
	kstring->SetFont(be_bold_font);
	kstring->SetHighColor(0,0,0); // text to Black
	memoryview->AddChild(kstring);

	// show the window
	AddChild(memoryview);
	Show();
	SetFlags(B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE);
	
//	BRect screenrect = Frame();
	memtyp = 1;
	Displaymemory();
}
Beispiel #27
0
CZipDecompressor::CZipDecompressor(int window_bits, TZipFlags flags)
    : CZipCompression(eLevel_Default, window_bits, 0, 0),
      m_NeedCheckHeader(true), m_IsGZ(false), m_SkipInput(0)
{
    SetFlags(flags);
}
Beispiel #28
0
LogManager::LogManager(const std::string& logFile)
{
	SetFlags(LOGFLAG_WRITE_TO_ALL);
	mLogFilename = logFile;
}
Beispiel #29
0
int main(int argc, char * argv[])
{
   int socket_num;         //socket descriptor
   char send_buf[BUF_SIZE];         //data buffer
   int send_len= 0;        //amount of data to send
   char in_buf[BUF_SIZE];         //data buffer
   char cmd_buf[CMD_SIZE];
   int in_len = 0;
   int sent= 0;            //actual amount of data sent
   u_int32_t seq = 0;
   Header header;
   int code = 0;
   int err = 0;
   int result = 0;
   int print = 1;
   fd_set readSet;
    
   /* check command line arguments  */
   if(argc!= 4)
   {
      printf("usage: %s host-name port-number handle\n", argv[0]);
      exit(1);
   }
   send_len = init_client(seq++, argv[3], send_buf); 
   /* set up the socket for TCP transmission  */
   socket_num= tcp_send_setup(argv[1], argv[2]);
   send(socket_num, send_buf, send_len, 0);
   /* get the data and send it */ 
   do {
      FD_ZERO(&readSet);
      FD_SET(STDIN_FILENO, &readSet);
      FD_SET(socket_num, &readSet);
      Prompt(&print, &err); 
      result = select(socket_num + 1, &readSet, NULL, NULL, NULL); 
      if(result < 0) {
         perror("select call");
         exit(-1);
      }
      if (FD_ISSET(STDIN_FILENO, &readSet)) {
         in_len = read(STDIN_FILENO, in_buf, BUF_SIZE);
         sscanf(in_buf, " %3s", cmd_buf);
         if (cmd_buf[2] == '\0' && cmd_buf[0] == '%') {
            code = handle_cmd(cmd_buf[1], send_buf, argv[3], &header, in_buf + strlen(cmd_buf), in_len, &send_len, &print);
            Send(&code, &sent, &seq, &socket_num, send_buf, &send_len); 
         }
         else {
            print = 1;
            printf("Invalid command\n");
         }
      }
      if(FD_ISSET(socket_num, &readSet)) {
         in_len = recv(socket_num, in_buf, BUF_SIZE, 0);
         if (in_len <= 0) {
            err = 2;
            printf("\nServer Terminated");
         }
         else {
            err = handle_server_data(in_buf, argv[3], in_len, socket_num);
            SetFlags(&err, &print); 
         }
      }
    } while(err != 2);
    close(socket_num);
    return 0; 
}
	virtual void Init()
	{
		SetFlags( ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS | ACH_SAVE_GLOBAL );
		SetGoal( 35 );
	}