예제 #1
0
파일: pfunction.cpp 프로젝트: MASHinfo/mame
static int get_prio(pstring v)
{
	if (v == "(" || v == ")")
		return 1;
	else if (v.left(1) >= "a" && v.left(1) <= "z")
		return 0;
	else if (v == "*" || v == "/")
		return 20;
	else if (v == "+" || v == "-")
		return 10;
	else if (v == "^")
		return 30;
	else
		return -1;
}
예제 #2
0
double nl_convert_base_t::get_sp_val(const pstring &sin)
{
	std::size_t p = 0;
	while (p < sin.length() && (m_numberchars.find(sin.substr(p, 1)) != pstring::npos))
		++p;
	pstring val = sin.left(p);
	pstring unit = sin.substr(p);
	double ret = get_sp_unit(unit) * val.as_double();
	return ret;
}