示例#1
0
int QTshotWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMAINWINDOW::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: doHelp(); break;
        case 1: doQuit(); break;
        case 2: doOpen(); break;
        case 3: doNew(); break;
        case 4: doSave(); break;
        case 5: doData(); break;
        case 6: doExport(); break;
        case 7: doExportOK(); break;
        case 8: doOptions(); break;
        case 9: doToggle(); break;
        case 10: doCollapse(); break;
        case 11: doPlan(); break;
        case 12: doExtended(); break;
        case 13: do3D(); break;
        case 14: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break;
        case 15: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 16: value_changed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 17: double_clicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QPoint(*)>(_a[4]))); break;
        }
        _id -= 18;
    }
    return _id;
}
void Command::writeAssembly()
{
  std::ofstream file;
  file.open(m_filename);
  if (!file.is_open()) {
    std::cerr<<"Error: unable to open output file!";
    exit(2);
  }
  file <<"/**"<<std::endl;
  file <<" *"<<m_filename<<std::endl;
  file <<" *"<<std::endl;
  file <<" * Generated by Bench Cookie Compiler!"<<std::endl;
  file <<" * Bench Cookie is... Experimental. Don't be mad."<<std::endl;
  file <<" */"<<std::endl;

  doBSS(file);

  file<<std::endl;

  doData(file);

  file<<std::endl<<std::endl;
  file<<"\t.text"<<std::endl;
  file<<"\t.global main"<<std::endl;
  file<<"\t.global printf"<<std::endl;
  file<<"\t.global scanf"<<std::endl;
  file<<"\t.global malloc"<<std::endl;

  doMain(file);

  /**
   * Free locals
   *
   * @todo Free locals when last used.
   *       Maybe change file to a list
   *       and search for last usage?
   */
  file<<"\t@ Free local vars"<<std::endl;
  for (int x = 0; x < m_int_declarations.size(); ++x) {
    file<<"\tldr %r0, =locals"<<std::endl;
    file<<"\tldr %r0, [%r0, #"<<4 * x<<"]"<<std::endl;
    file<<"\tbl free"<<std::endl<<std::endl;
  }

  file<<"\t@ locals are free"<<std::endl<<std::endl;

  file<<std::endl;
  file<<"\tmov %r0, $0"<<std::endl;
  /**
   * @DrewBarthel: printf is a toilet.
   */
  file<<"\tbl fflush"<<std::endl;
  file<<"\tmov %r7, $1"<<std::endl;

  /** Toilet has been flushed **/

  file<<"\tswi $0"<<std::endl;
  file<<"\t.end"<<std::endl;
  file.close();
}// allocate enough space for drew-sized strings.
示例#3
0
void Inverter::newClient()
{
    // an inverter has responded
    // add this to our main socket
    // note that this currently only handes one inverter
    m_socket = m_server->nextPendingConnection();

    if (m_socket)
    {
        // set up socket and signals for asynchronouse connection
        // start a timer that will ask the inverter for its front screen
        // display
        m_socket->setReadBufferSize(READ_BUFFER_SIZE);

        // general socket signals
        connect(m_socket, SIGNAL(disconnected()),this, SLOT(disconnected()));
        connect(m_socket, SIGNAL(readyRead()),this, SLOT(readyRead()));

        // start a timer to poll the inverter for current stats
        connect(&m_dataTimer, SIGNAL(timeout()), this, SLOT(doData()));
        m_dataTimer.start(DATA_TIME);

        m_connectTimer.stop();
    }
}
示例#4
0
int SplashWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: doOpen(); break;
        case 1: doData(); break;
        case 2: doCancel(); break;
        }
        _id -= 3;
    }
    return _id;
}
示例#5
0
//0:exit,1:continue
int CwxBinlogOp::doCommand(char* szCmd) {
  string strCmd;
  list < string > value;
  CwxCommon::trim(szCmd);
  strCmd = szCmd;
  CwxCommon::split(strCmd, value, ' ');
  list<string>::iterator iter = value.begin();
  //remove the empty value
  while (iter != value.end()) {
    if ((*iter).length() == 0) {
      value.erase(iter);
      iter = value.begin();
      continue;
    }
    iter++;
  }
  if (value.size() == 0)
    return 1;

  iter = value.begin();
  CWX_UINT32 uiItemNum = value.size();
  if (0 == strcasecmp((*iter).c_str(), "help")) {
    doHelp();
  } else if (0 == strcasecmp((*iter).c_str(), "info")) {
    doInfo();
  } else if (0 == strcasecmp((*iter).c_str(), "next")) {
    CWX_UINT32 uiNum = 1;
    if (1 != uiItemNum) {
      iter++;
      uiNum = strtoul((*iter).c_str(), NULL, 0);
    }
    doNext(uiNum);
  } else if (0 == strcasecmp((*iter).c_str(), "prev")) {
    CWX_UINT32 uiNum = 1;
    if (1 != uiItemNum) {
      iter++;
      uiNum = strtoul((*iter).c_str(), NULL, 0);
    }
    doPrev(uiNum);
  } else if (0 == strcasecmp((*iter).c_str(), "sid")) {
    if (2 != uiItemNum) {
      printf("Invalid sid command, using: sid value.\n");
      return 1;
    }
    iter++;
    doSid(strtoull((*iter).c_str(), NULL, 0));
  } else if (0 == strcasecmp((*iter).c_str(), "rec")) {
    if (2 != uiItemNum) {
      printf("Invalid rec command, using: rec value.\n");
      return 1;
    }
    iter++;
    doRecord(strtoul((*iter).c_str(), NULL, 0));
  } else if (0 == strcasecmp((*iter).c_str(), "group")) {
    if (2 != uiItemNum) {
      printf("Invalid group command, using: group value.\n");
      return 1;
    }
    iter++;
    doGroup(strtoul((*iter).c_str(), NULL, 0));
  } else if (0 == strcasecmp((*iter).c_str(), "key")) {
    if (3 != uiItemNum) {
      printf("Invalid key command, using: key k v.\n");
      return 1;
    }
    iter++;
    string strKey = *iter;
    doKey(strKey.c_str(), (*iter).c_str());
  } else if (0 == strcasecmp((*iter).c_str(), "head")) {
    doHead();
  } else if (0 == strcasecmp((*iter).c_str(), "data")) {
    doData();
  } else if (0 == strcasecmp((*iter).c_str(), "save")) {
    if (1 == uiItemNum) {
      printf("Invalid save command, using: save file.\n");
      return 1;
    }
    iter++;
    doSave(*iter);
  } else if (0 == strcasecmp((*iter).c_str(), "exit")) {
    return 0;
  } else {
    printf("Invalid command %s\n", (*iter).c_str());
    doHelp();
  }
  return 1;
}