Ejemplo n.º 1
0
JString
JCombineRootAndSuffix
	(
	const JCharacter* root,
	const JCharacter* suffix
	)
{
	JString name = root;
	if (suffix[0] != '.')
		{
		name.AppendCharacter('.');
		}
	name.Append(suffix);
	return name;
}
Ejemplo n.º 2
0
JString
JXFontManager::BuildFontName
	(
	const JCharacter*	xName,
	const JCharacter*	charSet,
	const JSize			size,
	const JFontStyle&	style,
	const JCharacter*	italicStr,
	const JBoolean		iso
	)
	const
{
#ifdef _J_USE_XFT
	JString xFontName;
	return xFontName;
#else
	// handle NxM separately

	nxmRegex.SetMatchOnly(kJTrue);
	if (nxmRegex.Match(xName))
		{
		JString xFontName = xName;
		if (style.bold)
			{
			xFontName += "bold";
			}
		return xFontName;
		}

	// any foundry

	JString xFontName = "-*-";

	// given name

	xFontName.Append(xName);

	// regular or boldface

	if (style.bold)
		{
		xFontName.Append("-bold");
		}
	else
		{
		xFontName.Append("-medium");
		}

	// regular or italic

	if (style.italic)
		{
		xFontName.Append(italicStr);
		}
	else
		{
		xFontName.Append("-r");
		}

	// normal character spacing, any pixel size

	xFontName.Append("-normal-*-*-");

	// font size

	xFontName.Append( JString(10*size, 0, JString::kForceNoExponent) );

	// screen resolution (apparently, we should always just use 75 dpi fonts),
	// any spacing, any avg width

	xFontName.Append("-75-75-*-*-");

	JIndex latinIndex;
	if (!JStringEmpty(charSet))
		{
		xFontName.Append(charSet);
		}
	else if (iso && JXGetLatinCharacterSetIndex(&latinIndex))
		{
		JString s = "iso8859-";
		s += JString(latinIndex, 0);
		xFontName.Append(s);
		}
	else if (iso)
		{
		xFontName.Append("iso*-*");
		}
	else
		{
		xFontName.Append("*-*");
		}

	// return the result

	return xFontName;
#endif
}
Ejemplo n.º 3
0
JString
JXFontManager::BuildStdFontName
	(
	const JCharacter*	xName,
	const JSize			size,
	const JFontStyle&	style,
	const JCharacter*	italicStr,
	const JCharacter*	iso
	)
	const
{
	// handle NxM separately

	if (nxmRegex.Match(xName))
		{
		JString xFontStr = xName;
		if (style.bold)
			{
			xFontStr += "bold";
			}
		return xFontStr;
		}

	// any foundry

	JString xFontStr = "-*-";

	// given name

	xFontStr.Append(xName);

	// regular or boldface

	if (style.bold)
		{
		xFontStr.Append("-bold");
		}
	else
		{
		xFontStr.Append("-medium");
		}

	// regular or italic

	if (style.italic)
		{
		xFontStr.Append(italicStr);
		}
	else
		{
		xFontStr.Append("-r");
		}

	// normal character spacing, any pixel size

	xFontStr.Append("-normal-*-*-");

	// font size

	xFontStr.Append( JString(10*(size+2), JString::kBase10) );

	// screen resolution (apparently, we should always just use 75 dpi fonts),
	// any spacing, any avg width, charset to match unicode

	xFontStr.Append("-75-75-*-*-");
	xFontStr.Append(iso);

	// return the result

	return xFontStr;
}
Ejemplo n.º 4
0
void
LLDBGetAssembly::HandleSuccess
	(
	const JString& cmdData
	)
{
	LLDBLink* link = dynamic_cast<LLDBLink*>(CMGetLink());
	if (link == NULL)
		{
		return;
		}

	lldb::SBCommandInterpreter interp = link->GetDebugger()->GetCommandInterpreter();
	if (!interp.IsValid())
		{
		return;
		}

	const CMLocation& loc = (GetDirector())->GetDisassemblyLocation();

	const JString cmd = "disassemble -n " + JPrepArgForExec(loc.GetFunctionName());
	lldb::SBCommandReturnObject result;
	interp.HandleCommand(cmd, result);

	JPtrArray<JString> addrList(JPtrArrayT::kDeleteAll);
	JString instText;

	if (result.IsValid() && result.Succeeded() && result.HasResult())
		{
		std::istringstream input(result.GetOutput());
		JString line, s;
		JSize maxOffsetLength = 0;
		while (!input.eof() && !input.fail())
			{
			line = JReadLine(input);

			JIndex i;
			if (line.LocateSubstring(":", &i) && i < line.GetLength())
				{
				s = line.GetSubstring(1, i-1);
				if (s.BeginsWith("->") && s.GetLength() > 2)
					{
					s = s.GetSubstring(3, s.GetLength());
					}
				s.TrimWhitespace();
				addrList.Append(s);

				JIndexRange r;
				if (offsetPattern.Match(s, &r))
					{
					maxOffsetLength = JMax(maxOffsetLength, r.GetLength());
					}

				if (!instText.IsEmpty())
					{
					instText.AppendCharacter('\n');
					}
				s = line.GetSubstring(i+1, line.GetLength());
				s.TrimWhitespace();
				instText.Append(s);
				}
			}

		const JSize count = addrList.GetElementCount();
		for (JIndex i=1; i<count; i++)
			{
			JString* s = addrList.NthElement(i);
			JIndexRange r;
			if (offsetPattern.Match(*s, &r))
				{
				const JSize pad = maxOffsetLength - r.GetLength();
				for (JIndex j=0; j<pad; j++)
					{
					s->InsertCharacter('0', r.first+2);
					}
				}
			}
		}

	(GetDirector())->DisplayDisassembly(&addrList, instText);
}
Ejemplo n.º 5
0
void
SMTPMessage::HandleAddresses()
{
	JPtrArray<JString> names(JPtrArrayT::kForgetAll);
	GParseNameList(*itsTo, names);
	ReplaceAliases(names);
	while (!names.IsEmpty())
		{
		JString* str = names.GetFirstElement();
		if (!str->BeginsWith("<"))
			{
			str->Prepend("<");
			str->Append(">");
			}
		if (itsToNames->InsertSorted(str,kJFalse))
			{
			names.RemoveElement(1);
			}
		else
			{
			names.DeleteElement(1);
			}
		}

	GParseNameList(*itsCC, names);
	ReplaceAliases(names);
	while (!names.IsEmpty())
		{
		JString* str = names.GetFirstElement();
		if (!str->BeginsWith("<"))
			{
			str->Prepend("<");
			str->Append(">");
			}
		JIndex findex;
		if (itsToNames->SearchSorted(str, JOrderedSetT::kFirstMatch, &findex))
			{
			names.DeleteElement(1);
			}
		else
			{
			if (itsCcNames->InsertSorted(str,kJFalse))
				{
				names.RemoveElement(1);
				}
			else
				{
				names.DeleteElement(1);
				}
			}
		}

	GParseNameList(*itsBCC, names);
	ReplaceAliases(names);
	while (!names.IsEmpty())
		{
		JString* str = names.GetFirstElement();
		if (!str->BeginsWith("<"))
			{
			str->Prepend("<");
			str->Append(">");
			}
		JIndex findex;
		if (itsToNames->SearchSorted(str, JOrderedSetT::kFirstMatch, &findex))
			{
			names.DeleteElement(1);
			}
		else
			{
			if (itsCcNames->SearchSorted(str, JOrderedSetT::kFirstMatch, &findex))
				{
				names.DeleteElement(1);
				}
			else
				{
				if (itsBccNames->InsertSorted(str,kJFalse))
					{
					names.RemoveElement(1);
					}
				else
					{
					names.DeleteElement(1);
					}
				}
			}
		}

}