Exemplo n.º 1
0
void
scrinterp::putch(int ch)
{
  cell_t x, y, mx, my;

  // We can handle all of the standard control chrs here
  switch (ch)
  {
  case '\r':                  // CR
    flushbuf();
    vs.wherexy(x, y);
    vs.gotoxy(0, y);
    break;

  case '\t':                  // TAB
    flushbuf();
    vs.wherexy(x, y);
    vs.maxxy(mx, my);
    x = cell_t((((x + 8) / 8) + 1) * 8);
    if (x >= mx)
    {
      x = cell_t(x % mx);
      goto dolf;
    }
    vs.gotoxy(x, y);
    break;

  case '\n':                  // NL
    flushbuf();
    vs.wherexy(x, y);
    vs.maxxy(mx, my);
  dolf:
    if (y == cell_t(my - 1))  // On last line
      vs.scroll(0, 0, mx, my, 1);
    else
      ++y;
    vs.gotoxy(x, y);
    break;

  case '\007':                 // BELL
    // beep() !
    break;

  case '\b':
    vs.wherexy(x, y);
    if (x > 0)
      vs.gotoxy(--x, y);
    break;

  case '\x0c':                // LF
    // Should to a cls here with home, perhaps...
    break;

  default:
    putbuf(ch);
    if (flushevery)
      flushbuf();
    break;
  }
}
Exemplo n.º 2
0
void
avatar::resetattr(int ch)
{
  vs.setattr(cell_t(ch & 0x7f));
  dispfunc = 0;
  arg1 = -1;
}
Exemplo n.º 3
0
void TableWidget::AddRow( int height, bool fixed)
{
    _rows.push_back( cell_t((fixed)? -height:height, _h-(_frame_top + _frame_bottom)) );
    _need_update = true;
    _h += height;
    Resize( _w, _h);
}
Exemplo n.º 4
0
void TableWidget::AddColumn( int width , bool fixed)
{
    _columns.push_back( cell_t((fixed)? -width:width, _w-(_frame_left + _frame_right)) );
    _need_update = true;
    _w += width;
    Resize( _w, _h);
}
Exemplo n.º 5
0
void
avatar::clrarea(int ch)
{
  area[counter++] = cell_t(ch);     // Store data
  if (counter == 3)
  {
    #define cl_attr  area[0]
    #define cl_rows  area[1]
    #define cl_cols  area[2]
    vs.setattr(cl_attr);
    cell_t x, y;
    vs.wherexy(x, y);
    vs.scroll(x, y, cell_t(x + cl_cols - 1), cell_t(y + cl_rows - 1), cl_rows, 1);
    rptlen = arg1 = counter = -1;
    dispfunc = 0;
  }
}
Exemplo n.º 6
0
void basic_sheet_t::add_constant(name_t name, const any_regular_t& value)
{
    constant_cell_set_m.push_back(cell_t(value));
    
    const cell_t* cell(&constant_cell_set_m.back());
    
    variable_index_m.insert(std::make_pair(name.c_str(), cell));
}
Exemplo n.º 7
0
void
avatar::setpos(int ch)
{
  if (arg1 == -1)
    arg1 = ch;
  else
  {
    cell_t  x = cell_t(ch),
            y = cell_t(arg1);
    cell_t  mx, my;
    vs.maxxy(mx, my);
    --x; --y; // Avatar uses 1-based coords
    if (x < mx && y < my)
      vs.gotoxy(x, y);
    counter = arg1 = -1;
    dispfunc = 0;
  }
}
Exemplo n.º 8
0
void
avatar::setarea(int ch)
{
  area[counter++] = cell_t(ch);   // Store data
  if (counter == 4)
  {
    #define sa_attr  area[0]
    #define sa_char  area[1]
    #define sa_rows  area[2]
    #define sa_cols  area[3]
    vs.setattr(sa_attr);
    vs.setfill(sa_char);
    cell_t x, y;
    vs.wherexy(x, y);
    vs.scroll(x, y, cell_t(x + sa_cols - 1), cell_t(y + sa_rows - 1), sa_rows, 1);
    vs.setfill(' ');
    rptlen = arg1 = counter = -1;
    dispfunc = 0;
  }
}
Exemplo n.º 9
0
void
avatar::scroll(int ch)
{
  area[counter++] = cell_t(ch);   // Store data
  if (counter == 5)
  {
    #define s_lines area[0]
    #define s_upper area[1]
    #define s_left  area[2]
    #define s_lower area[3]
    #define s_right area[4]
    vs.scroll(--s_left, --s_upper, --s_right, --s_lower, s_lines, arg1 == ctrl('J'));
    rptlen = arg1 = counter = -1;
    dispfunc = 0;
  }
}
Exemplo n.º 10
0
static cell_t SQL_AddQuery(IPluginContext *pContext, const cell_t *params)
{
	HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);

	Transaction *txn;
	Handle_t handle = params[1];
	HandleError err = handlesys->ReadHandle(handle, hTransactionType, &sec, (void **)&txn);
	if (err != HandleError_None)
		return pContext->ThrowNativeError("Invalid handle %x (error %d)", handle, err);

	char *query;
	pContext->LocalToString(params[2], &query);

	Transaction::Entry entry;
	entry.query = query;
	entry.data = params[3];
	txn->entries.append(ke::Move(entry));

	return cell_t(txn->entries.length() - 1);
}
Exemplo n.º 11
0
bool
Interpreter::visitSDIV(PawnReg dest)
{
  PawnReg dividendReg = dest;
  PawnReg divisorReg = (dest == PawnReg::Pri) ? PawnReg::Alt : PawnReg::Pri;

  cell_t divisor = regs_[divisorReg];
  cell_t dividend = regs_[dividendReg];

  if (divisor == 0) {
    cx_->ReportErrorNumber(SP_ERROR_DIVIDE_BY_ZERO);
    return false;
  }

  // -INT_MIN / -1 is an overflow.
  if (divisor == -1 && dividend == cell_t(0x80000000)) {
    cx_->ReportErrorNumber(SP_ERROR_INTEGER_OVERFLOW);
    return false;
  }

  regs_.pri() = dividend / divisor;
  regs_.alt() = dividend % divisor;
  return true;
}
Exemplo n.º 12
0
void
avatar::setvideo(int ch)
{
  cell_t  x, y,
          mx, my;
  int     nx =0,
          ny =0;

  switch (ch)
  {
    case ctrl('A'):
      dispfunc = &avatar::setattr;
      arg1 = -1;
      break;
    case ctrl('B'):       // Blink
      vs.setbg(cell_t(vs.getbg() | 0x8));
      dispfunc = 0;
      break;
    case ctrl('C'):       // Row up
      ny = -1;
      goto mvxy;
    case ctrl('D'):       // Row down
      ny = 1;
      goto mvxy;
    case ctrl('E'):       // Column to left (erase)
      nx = -1;
      goto mvxy;
    case ctrl('F'):       // Column to right (forward)
      nx = 1;
    mvxy:
      vs.wherexy(x, y);
      x = cell_t(x + nx);
      y = cell_t(y + ny);
      vs.maxxy(mx, my);
      if (x < mx && y < my)
        vs.gotoxy(x, y);
      dispfunc = 0;
      break;
    case ctrl('H'):       // Set cursor position
      arg1 = -1;
      dispfunc = &avatar::setpos;
      break;
    case ctrl('I'):       // Toggle insertmode on
      insertmode = 1;
      dispfunc = 0;
      return;
    case ctrl('J'):       // scroll area up
    case ctrl('K'):       // scroll area down
      dispfunc = &avatar::scroll;
      arg1 = ch;          // Save type of scroll
      counter = -1;       // Used as index to area coord
      break;
    case ctrl('L'):       // Clear area to attribute
      dispfunc = &avatar::clrarea;
      counter = -1;
      break;
    case ctrl('M'):
      dispfunc = &avatar::setarea;
      counter = -1;
      break;
    case ctrl('N'):
      // unsupported
      dispfunc = 0;
      break;
    case ctrl('G'):       // Clear to eol
      vs.wherexy(x, y);
      vs.maxxy(mx, my);
      vs.repchr(' ', mx - x);
      vs.gotoxy(x, y);
      dispfunc = 0;
      break;
    case ctrl('Y'):       // Repeat sequence
      dispfunc = &avatar::rptseq;
      counter = rptlen = -1;
      return;   // Don't reset insertmode
  }
  insertmode = 0;
}