예제 #1
0
void FormatDisassembly::operator()(std::pair<Address const&, Address const&> const& rAddressesRange, u32 Flags)
{
  auto& rDoc          = m_rCore.GetDocument();
  Address CurAddr     = std::get<0>(rAddressesRange);
  auto const& LastAddr = std::get<1>(rAddressesRange);

  if (CurAddr == LastAddr)
  {
    _Format(CurAddr, Flags);
    return;
  }

  while (!(CurAddr == LastAddr))
  {
    _Format(CurAddr, Flags);

    if (!rDoc.GetNextAddress(CurAddr, CurAddr))
      return;
  }
}
예제 #2
0
void FormatDisassembly::operator()(Address::List const& rAddresses, u32 Flags)
{
  m_rPrintData.Clear();

  if (rAddresses.empty())
    return;

  m_rPrintData.PrependAddress(Flags & ShowAddress ? true : false);

  for (auto const& CurAddr : rAddresses)
    _Format(CurAddr, Flags);
}
예제 #3
0
void FormatDisassembly::operator()(Address const& rAddress, u32 Flags, u16 LinesNo)
{
  m_rPrintData.Clear();
  m_rPrintData.PrependAddress(Flags & ShowAddress ? true : false);

  auto& rDoc = m_rCore.GetDocument();
  Address CurAddr = rAddress;

  for (u16 i = 0; i < LinesNo; ++i)
  {
    _Format(CurAddr, Flags);

    if (!rDoc.GetNextAddress(CurAddr, CurAddr))
      return;
  }
}
예제 #4
0
//---------------------------------------------------------
void CSG_MetaData::Fmt_Content(const wchar_t *Format, ...)
{
	wxString	s;

	va_list	argptr;

#ifdef _SAGA_LINUX
	wxString	_Format(Format);	_Format.Replace("%s", "%ls");	// workaround as we only use wide characters since wx 2.9.4 so interpret strings as multibyte
	va_start(argptr, _Format);
	s.PrintfV(_Format, argptr);
#else
	va_start(argptr, Format);
	s.PrintfV(Format, argptr);
#endif

	m_Content	= CSG_String(&s);

	va_end(argptr);
}
예제 #5
0
//---------------------------------------------------------
int CSG_String::Printf(const wchar_t *Format, ...)
{
	va_list	argptr;

#ifdef _SAGA_LINUX
	// workaround as we only use wide characters
	// since wx 2.9.4 so interpret strings as multibyte
	wxString	_Format(Format);	_Format.Replace("%s", "%ls");
	va_start(argptr, _Format);
	m_pString->PrintfV(_Format, argptr);
#else
	va_start(argptr, Format);
	m_pString->PrintfV(Format, argptr);
#endif

	va_end(argptr);

	return( (int)Length() );
}
예제 #6
0
파일: TypeEditors.cpp 프로젝트: DonCN/haiku
void
NumberEditor::_UpdateText()
{
	if (fEditor.Lock()) {
		const char* number;
		if (fEditor.GetViewBuffer((const uint8**)&number) == B_OK) {
			char buffer[64];
			char format[16];
			switch (fEditor.Type()) {
				case B_FLOAT_TYPE:
				{
					float value = *(float*)number;
					snprintf(buffer, sizeof(buffer), "%g", value);
					break;
				}
				case B_DOUBLE_TYPE:
				{
					double value = *(double *)number;
					snprintf(buffer, sizeof(buffer), "%g", value);
					break;
				}
				case B_SSIZE_T_TYPE:
				case B_INT8_TYPE:
				case B_INT16_TYPE:
				case B_INT32_TYPE:
				case B_INT64_TYPE:
				case B_OFF_T_TYPE:
				{
					_Format(format);
					switch (_Size()) {
						case 1:
						{
							int8 value = *(int8 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
						case 2:
						{
							int16 value = *(int16 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
						case 4:
						{
							int32 value = *(int32 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
						case 8:
						{
							int64 value = *(int64 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
					}
					break;
				}

				default:
				{
					_Format(format);
					switch (_Size()) {
						case 1:
						{
							uint8 value = *(uint8 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
						case 2:
						{
							uint16 value = *(uint16 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
						case 4:
						{
							uint32 value = *(uint32 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
						case 8:
						{
							uint64 value = *(uint64 *)number;
							snprintf(buffer, sizeof(buffer), format, value);
							break;
						}
					}
					break;
				}
			}
			fTextControl->SetText(buffer);
			fPreviousText.SetTo(buffer);
		}

		fEditor.Unlock();
	}
}