Ejemplo n.º 1
0
void machine_t::addlabel(const char* name, int32_t pos, int)
{
  std::string n = upper(name);

  if ( n.empty() )
    error("Empty label");
  else {
    n.erase(n.length()-1, 1); // remove ":"
    labels.push_back(label_t(n.c_str(), pos));
  }
}
Ejemplo n.º 2
0
void LabelMap::RegisterLabel(const std::string &label, u16 lval, LabelType type)
{
	u16 old_value;
	if (GetLabelValue(label, &old_value) && old_value != lval) 
	{
		printf("WARNING: Redefined label %s to %04x - old value %04x\n",
			   label.c_str(), lval, old_value);
		DeleteLabel(label);
	}
	labels.push_back(label_t(label, lval, type));
}
Ejemplo n.º 3
0
void compiler::compile_label(const std::string& label)
{
  int32_t address = m.get_label_address(label);

  m.load(PUSH);

  // if label not found, mark it for update
  if ( address == -1 ) {
    check_label_name(label);
    forwards.push_back(label_t(label, m.pos()));
  }

  m.load(address);
}
Ejemplo n.º 4
0
void compiler::compile_function_call(const std::string& function)
{
  // Return address is here plus four instructions
  m.load(PUSHIP); m.load(m.pos() + 4*m.wordsize());

  // Push function destination address -- update it later
  m.load(PUSH);
  forwards.push_back(label_t(function, m.pos()));
  m.load(-1); // just push an arbitrary number

  // Jump to function
  m.load(JMP);

  // This is the return point
}
Ejemplo n.º 5
0
void tab_group_t::measure(extents_t& result)
{
    assert(control_m);

    // REVISIT (fbrereto) : A lot of static metrics values added here

    for (tab_set_t::iterator first(items_m.begin()), last(items_m.end()); first != last; ++first)
    {
        extents_t attrs;
        measure_label_text(label_t(first->name_m, std::string(), 0, theme_m), attrs, ::GetParent(control_m));

        result.width() += attrs.width() + 18;
        result.height() = (std::max)(result.height(), attrs.height());
    }

    result.vertical().frame_m.first = result.height() + 7;

    result.height() = 5;
}