예제 #1
0
FUNCTION void Q64G(obj Q4F0, obj Q62D, int Q571)
{
  int Q63U;
  list metal;
  clearList(metal);
  Q4S8(metal, Q62D);
  for(int num = numInList(metal); num > 0x00; num --)
  {
    int Q56Z;
    obj Q5UD = metal[0x00];
    int Q4Q1 = getResource(Q56Z, Q5UD, "metal", 0x03, 0x02);
    if(Q571 >= Q56Z)
    {
      transferResources(Q4F0, Q5UD, Q56Z, "metal");
      deleteObject(Q5UD);
      removeItem(metal, 0x00);
      Q571 = Q571 - Q56Z;
    }
    else
    {
      transferResources(Q4F0, Q5UD, Q571, "metal");
      Q4Q1 = getResource(Q56Z, Q5UD, "metal", 0x03, 0x02);
      if(Q56Z < 0x01)
      {
        deleteObject(Q5UD);
      }
      break;
    }
  }
  clearList(metal);
  return;
}
	Status LogReader::SetFilter(const char *a_filter, unsigned int a_filterSize,
												unsigned int a_maxFindSize, bool a_raw)
	{
		if (a_filterSize > 0 && a_filter == InvPtr)
			return s_invalidParameter;

		m_filter = a_filter;
		m_filterSize = a_filterSize;
		clearList();
		StrClose *l_strClose;
		if (!a_raw)
		{
			StrEntry *const l_strEntry = new(std::nothrow) StrEntry;
			if (l_strEntry == InvPtr)
				return s_memAllocError;

			l_strClose = new(std::nothrow) StrClose;
			if (l_strClose == InvPtr)
			{
				delete l_strEntry;
				return s_memAllocError;

			}

			addToList(l_strEntry);

		}

		m_status = s_ok;
		machine();
		if (m_status == s_ok && m_list == InvPtr)
		{
			Substit *const l_substit = new(std::nothrow) Substit(0, true);
			if (l_substit == InvPtr)
				m_status = s_memAllocError;
			else
				addToList(l_substit);

		}

		if (m_status != s_ok)
		{
			delete l_strClose;
			clearList();

		}
		else
		{
			if (!a_raw)
				addToList(l_strClose);

			m_raw = a_raw;
			m_maxFindSize = a_maxFindSize;
			reset();

		}

		return m_status;

	}
예제 #3
0
DownloadManager::DownloadManager(QWidget* parent)
    : QWidget(parent)
    , ui(new Ui::DownloadManager)
    , m_isClosing(false)
    , m_lastDownloadOption(NoOption)
{
    setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
    ui->setupUi(this);
#ifdef Q_OS_WIN
    if (QtWin::isCompositionEnabled()) {
        QtWin::extendFrameIntoClientArea(this);
    }
#endif
    ui->clearButton->setIcon(QIcon::fromTheme("edit-clear"));
    QzTools::centerWidgetOnScreen(this);

    connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearList()));

    QShortcut* clearShortcut = new QShortcut(QKeySequence("CTRL+L"), this);
    connect(clearShortcut, SIGNAL(activated()), this, SLOT(clearList()));

    loadSettings();

    QzTools::setWmClass("Download Manager", this);

#ifdef W7TASKBAR
    if (QtWin::isRunningWindows7()) {
        win7.init(QtWin::hwndOfWidget(this));
    }
#endif
}
예제 #4
0
ResourceLoader::~ResourceLoader() {
	for (Common::Array<ResourceCache>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
		ResourceCache &r = *i;
		delete[] r.fname;
		delete[] r.resPtr;
	}
	clearList(_models);
	clearList(_colormaps);
	clearList(_keyframeAnims);
	clearList(_lipsyncs);
}
예제 #5
0
void LLFloaterTopObjects::onRefresh()
{
	U32 mode = STAT_REPORT_TOP_SCRIPTS;
	U32 flags = 0;
	std::string filter = "";

	mode   = mCurrentMode;
	flags  = mFlags;
	filter = mFilter;
	clearList();

	LLMessageSystem *msg = gMessageSystem;
	msg->newMessageFast(_PREHASH_LandStatRequest);
	msg->nextBlockFast(_PREHASH_AgentData);
	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID() );
	msg->nextBlockFast(_PREHASH_RequestData);
	msg->addU32Fast(_PREHASH_ReportType, mode);
	msg->addU32Fast(_PREHASH_RequestFlags, flags);
	msg->addStringFast(_PREHASH_Filter, filter);
	msg->addS32Fast(_PREHASH_ParcelLocalID, 0);

	msg->sendReliable(gAgent.getRegionHost());

	mFilter.clear();
	mFlags = 0;
}
예제 #6
0
/* List Node Test function */
void list_node_test(void)
{
	Node_t *pList = NULL;
	elemType data[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
	elemType *ret_data;

	initList(&pList);
	pList = createList(pList, data, 10L);
	printList(pList);
	lk_print("The size of pList: %ld.\n", sizeList(pList));
	lk_print("getElement(pList, 4) = %d.\n", getElement(pList, 4));
	ret_data = getDataFromList(pList, 4);
	lk_print("ret_data[4] = %d.\n", *ret_data);
	setDataByPosition(pList, 4, 0);
	printList(pList);
	insertHeadNode(&pList, 9);
	lk_print("The size of pList: %ld.\n", sizeList(pList));
	printList(pList);
	insertLastNode(&pList, 0);
	printList(pList);
	lk_print("The size of pList: %ld.\n", sizeList(pList));
	insertNodeByPosition(&pList, 14, 8);
	printList(pList);
	deleteNodeByPosition(&pList, 12);
	printList(pList);
	swapTwoNodeElemInList(&pList, 10, 10);
	printList(pList);
	clearList(pList);
	lk_print("done\n");
}
예제 #7
0
/**********************************************************
 * main: Prompts the user to enter an operation code,     *
 *       then calls a function to perform the requested   *
 *       action. Repeats until the user enters the        *
 *       command 'q'. Prints an error message if the user *
 *       enters an illegal code.                          *
 **********************************************************/
int main(void)
{
  char code;

  struct player *team_roster = NULL;  
  printf("Operation Code: a for appending to the roster, d for deleteing a player, f for finding a player"
	  ", p for printing the roster; q for quit.\n");
  for (;;) {
    printf("Enter operation code: ");
    scanf(" %c", &code);
    while (getchar() != '\n')   /* skips to end of line */
      ;
    switch (code) {
      case 'a': team_roster = append_to_list(team_roster);
		break;
      case 'f': find_player(team_roster);
                break;
      case 'p': printList(team_roster);
                break;
      case 'd': delete_from_list(team_roster);
		break; 
      case 'q': clearList(team_roster);
		printf("\n");
		return 0;
      default:  printf("Illegal code");
    }
    printf("\n");
  }
}
예제 #8
0
void MainWindow::newListTriggerred()
{
    if (this->modified.isModified() && promptForSaving() && promptForFilename() && !save()) {
        return;
    }
    clearList();
}
예제 #9
0
void main()
{
    int a[10] = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
    int i;
    struct List L;
    initList(&L, 5);
    for(i = 0; i < 10; i++){
        insertLastList(&L, a[i]);
    }
    insertPosList(&L, 11, 48);        insertPosList(&L, 1, 64);
    printf("%d ", getElem(&L, 1));
    traverseList(&L);
    printf("%d ", findList(&L, 10));
    updatePosList(&L, 3, 20);
    printf("%d ", getElem(&L, 3));
    traverseList(&L);
    deleteFirstList(&L);            deleteFirstList(&L);
    deleteLastList(&L);                deleteLastList(&L);
    deletePosList(&L, 5);            ;deletePosList(&L, 7);
    printf("%d ", sizeList(&L));
    printf("%d ", emptyList(&L));
    traverseList(&L);
    clearList(&L);
    return 0;
}
예제 #10
0
//读数据转化文件,生成转换列表
int CGateCmdHandler::init(void)
{
    char fileName[256] = {0};
    char fileDir[256] = {0};
    char processName[256] = {0};
    FILE* p_file = NULL;
    char szExp[1024] = {0};    

    clearList();

    if (getExePath(fileDir, processName, 256))
        return -1;   

    sprintf(fileName, "%s/%s", fileDir, FILE_DATA_TRANS);

    p_file = fopen(fileName, "r");
    if (!p_file)
        return -1;

    while (fgets(szExp, 1024, p_file)) {
        if (addExpression(szExp)) {
            fclose(p_file);
            return -1;
        }
    }

    fclose(p_file);
    
    return 0;
}
예제 #11
0
TRIGGER( use )(obj user)
{
  obj player = user;
  if(!hasObjVar(this, "bountyPlayer"))
  {
    systemMessage(user, "Select player to bounty:");
    targetObj(user, this);
    return(0x00);
  }
  string Q5IU = "PD BugKiller";
  if(hasObjVar(this, "bountyPlayerName"))
  {
    Q5IU = getObjVar(this, "bountyPlayerName");
  }
  systemMessage(user, "creating bounty for (" + objtoint(player) + ".");
  obj bountyInfo = createNoResObjectAt(0x01, getLocation(user));
  setObjVar(bountyInfo, "subject", player);
  attachScript(bountyInfo, "bountyinfo");
  list args = list( player, 0x029A, 0x00, Q5IU );
  message(bountyInfo, "addBounty", args);
  int Q4Q1 = teleport(bountyInfo, getRelayLoc(player));
  if(isValid(bountyInfo))
  {
    clearList(args);
    message(bountyInfo, "teleported", args);
  }
  args = list( getAdjFame(user) );
  systemMessage(user, "MurderReport: Messaging via probe to " + objtoint(user) + ".");
  Q56V(player, "murderReport", args);
  obj head = createNoResObjectIn(0x1DA0, getBackpack(user));
  setObjVar(head, "nameVar", Q5IU);
  setObjVar(head, "controller", player);
  return(0x00);
}
예제 #12
0
//---------------------------------------------------------------------------
long Terrain::init (PacketFile* pakFile, int whichPacket, unsigned long visibleVertices, volatile float& percent,
					float percentRange )
{
	clearList();
	clearMoverList();
	
	long result = pakFile->seekPacket( whichPacket );
	if (result != NO_ERR)
		STOP(("Unable to seek Packet %d in file %s",whichPacket,pakFile->getFilename()));
	
	int tmp = pakFile->getPacketSize();
	realVerticesMapSide = sqrt( float(tmp/ sizeof(PostcompVertex)));
	
	if (!justResaveAllMaps && 
		(realVerticesMapSide != 120) &&
		(realVerticesMapSide != 100) && 
		(realVerticesMapSide != 80) &&
		(realVerticesMapSide != 60))
	{
		PAUSE(("This map size NO longer supported %d.  Must be 120, 100, 80 or 60 now!  Can Continue, for NOW!!",realVerticesMapSide));
//		return -1;
	}
	
	init( realVerticesMapSide, pakFile, visibleVertices, percent, percentRange );	
	
	return(NO_ERR);
}
예제 #13
0
CSyncQueue::~CSyncQueue()
{
	clearQueue();
	clearList();
	DeleteCriticalSection(&this->wQueue);
	DeleteCriticalSection(&this->dList);
}
예제 #14
0
ToolbarEntry::~ToolbarEntry() {
	XOJ_CHECK_TYPE(ToolbarEntry);

	clearList();

	XOJ_RELEASE_TYPE(ToolbarEntry);
}
예제 #15
0
DownloadManager::DownloadManager(QWidget* parent)
    : QWidget(parent)
    , ui(new Ui::DownloadManager)
    , m_isClosing(false)
{
    setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
    ui->setupUi(this);
#ifdef Q_WS_WIN
    if (QtWin::isCompositionEnabled()) {
        QtWin::extendFrameIntoClientArea(this);
    }
#endif
    ui->clearButton->setIcon(QIcon::fromTheme("edit-clear"));
    qz_centerWidgetOnScreen(this);

    m_networkManager = mApp->networkManager();

    connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearList()));

    loadSettings();

#ifdef W7TASKBAR
    if (QtWin::isRunningWindows7()) {
        win7.init(this->winId());
    }
#endif
}
예제 #16
0
/**********************************************************
 * main: Prompts the user to enter an operation code,     *
 *       then calls a function to perform the requested   *
 *       action. Repeats until the user enters the        *
 *       command 'q'. Prints an error message if the user *
 *       enters an illegal code.                          *
 **********************************************************/
int main(void)
{
  char code;

  struct part *inv = NULL;   /* points to first part */
  for (;;) {
    printf("Enter operation code: ");
    scanf(" %c", &code);
    while (getchar() != '\n')   /* skips to end of line */
      ;
    switch (code) {
      case 'i': inv = insert(inv);
                break;
      case 's': search(inv);
                break;
      case 'u': update(inv);
                break;
      case 'p': print(inv);
                break;
      case 'q': 
		clearList(inv);
		return 0;
      default:  printf("Illegal code\n");
    }
    printf("\n");
  }
}
예제 #17
0
/*virtual*/
_TDL_NamesList::~_TDL_NamesList()
{
	/* Clear the arraylist */
	/* Note:  This can't happen in _TDL_ArrayList since that base
	 * class can't access _TDL_NamesList's version of deleteElement().
	 */
  clearList();
}
예제 #18
0
void AstarPathfinding::getPath(float srcX, float srcY, float destX, float destY, PointList_t &path){

    ///init
    this->srcP.x = srcX;
    this->srcP.y = srcY;
    this->destP.x = destX;
    this->destP.y = destY;
    clearList(path);
    clearList(openedList);
    clearList(closedList);

    ///set the first point
    currentP = new Point_t();
    currentP->x = srcX;
    currentP->y = srcY;
    currentP->costa = 0.f;
    currentP->costb = (destX - srcX)*(destX - srcX) + (destY - srcY)*(destY - srcY);
    currentP->totalcost = currentP->costa + currentP->costb;
    openedList.push_back(currentP);

    ///perform
    while(!openedList.empty() && !(currentP->x == destX && currentP->y == destY) ){
        //std::cout << "currentP = " << currentP->x << "; " << currentP->y << "\n";

        openedList.remove(currentP);
        closedList.push_back(currentP);
        perform();

        currentP = getBest();
    }


    ///return result
    if(currentP != NULL && currentP->x == destX && currentP->y == destY){
        do{
            Point_t* p = new Point_t();
            p->x = currentP->x;
            p->y = currentP->y;
            path.push_front(p);
            currentP = currentP->previous;
        }while(currentP != NULL);
    }

    clearList(openedList);
    clearList(closedList);
}
예제 #19
0
  void detachDocument() {
    if (!m_document)
      return;

    clearList();
    m_document->undoHistory()->removeObserver(this);
    m_document = nullptr;
  }
예제 #20
0
FUNCTION void Q4S8(list metal, obj Q57Q)
{
  clearList(metal);
  for(int Q572 = 0x1BEF; Q572 <= 0x1BF4; Q572 ++)
  {
    getObjectsOfTypeIn(metal, Q57Q, Q572);
  }
  return;
}
예제 #21
0
void
McGripOptimizer::reset()
{
	clearList(JTD_negI_list);
	clearList(NegB_list);
	clearList(GO_list);
	clearList(FO_list);
	clearList(SO_list);
	clearList(Th_list);
	clearList(lowerBounds_list);
	clearList(upperBounds_list);
}
예제 #22
0
void colorChooser::constructMenuObjects() {

  clearListAction_ = new QAction(tr("Clear \"Clicked colors\" list"), this);
  connect(clearListAction_, SIGNAL(triggered()),
          this, SLOT(clearList()));

  addZoomActionsToImageMenu();
  imageMenu()->addAction(imageInfoAction());
  imageMenu()->addAction(clearListAction_);
}
예제 #23
0
void ewol::widget::ListFileSystem::regenerateView() {
	clearList();
	m_selectedLine = -1;
	m_list.clear();
	m_originScrooled.setValue(0,0);
	etk::FSNode tmpFolder(m_folder.get());
	// get the new list : 
	m_list = tmpFolder.folderGetSubList(m_showHidden, m_showFolder, m_showFile, m_showTemporaryFile);
	// request a redraw ...
	markToRedraw();
}
예제 #24
0
void ToolbarEntry::operator =(const ToolbarEntry & e) {
	XOJ_CHECK_TYPE(ToolbarEntry);

	this->name = e.name;
	clearList();

	for (GList * l = e.entries; l != NULL; l = l->next) {
		ToolbarItem * item = (ToolbarItem *) l->data;
		this->entries = g_list_append(this->entries, new ToolbarItem(*item));
	}
}
예제 #25
0
void Gear_PackList::runVideo()
{
  ListType *listType = _LIST_OUT->type();
  
  if (_LIST_IN->connected())
    listType->assign(_LIST_IN->type()->begin(), _LIST_IN->type()->end());
  else 
    clearList();  

  listType->push_back(_STR1->type());

}
예제 #26
0
void phoneListSlotView::fillList(void) {
	struct pbSlot *sl = gsm->getPBSlot(memSlot.String());
	struct pbNum *num;

	clearList();

	int j = sl->pb->CountItems();
	for (int i=0;i<j;i++) {
		num = (struct pbNum*)sl->pb->ItemAt(i);
		list->AddItem(new phoneSlotListItem(num, gsm));
	}
}
예제 #27
0
SurfaceDialog::SurfaceDialog( QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl )
{
	setName( "SurfaceDialog" );
	setWindowTitle(tr("MantidPlot - Define surface plot"));
    setSizeGripEnabled( true );

	QHBoxLayout *hbox1 = new QHBoxLayout();
	hbox1->addWidget(new QLabel(tr( "Surface type" )));
	boxType = new QComboBox();
	boxType->addItem( tr( "Function" ) );
	boxType->addItem( tr( "Parametric" ) );
	hbox1->addWidget(boxType);
	hbox1->addStretch();

	optionStack = new QStackedWidget();

	initFunctionPage();
	initParametricSurfacePage();

	buttonClear = new QPushButton(tr("Clear &list"));
	buttonOk = new QPushButton(tr("&OK"));
    buttonOk->setDefault(true);
    buttonCancel = new QPushButton(tr("&Close"));

    QBoxLayout *bl2 = new QBoxLayout ( QBoxLayout::LeftToRight);
    bl2->addStretch();
	bl2->addWidget(buttonClear);
	bl2->addWidget(buttonOk);
	bl2->addWidget(buttonCancel);

	QVBoxLayout* vl = new QVBoxLayout(this);
    vl->addLayout(hbox1);
	vl->addWidget(optionStack);
	vl->addLayout(bl2);

	ApplicationWindow *app = static_cast<ApplicationWindow *>(parent);
	if (app){
		boxFunction->insertItems(0, app->surfaceFunc);
		boxX->setCompleter (new QCompleter(app->d_param_surface_func));
		boxY->setCompleter (new QCompleter(app->d_param_surface_func));
		boxZ->setCompleter (new QCompleter(app->d_param_surface_func));
	}

	d_graph = 0;
    setFocusProxy(boxFunction);

	connect( boxType, SIGNAL(activated(int)), optionStack, SLOT(setCurrentIndex(int)));
	connect( buttonClear, SIGNAL(clicked()), this, SLOT(clearList()));
    connect( buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
    connect( buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
}
예제 #28
0
파일: Message.cpp 프로젝트: maoxuli/dns
// Decode a response packet
bool dns::Message::fromBuffer(unsigned char* buf, size_t size)
{
    bool bRet = true;
    size_t offset = 0;
        
    if (!m_header.fromBuffer(buf, size, offset))
    {
        std::cout << "Decode header error, offset: " << offset << std::endl;
        bRet = false;
    }
    else
    {
        // Question and answers pointer is relative to the end of header
        clearList();
        
        // questions
        for (int i = 0; bRet && i < m_header.qdcount(); ++i)
        {
            dns::Question* question = dns::Question::fromBuffer(buf, size, offset);
            if (question == NULL)
            {
                std::cout << "Decode question error, offset: " << offset << std::endl;
                bRet = false;
            }
            else
            {
                m_questions.push_back(question);
            }
        }
        
        // answers
        for (int i = 0; bRet && i < m_header.ancount(); ++i)
        {
            dns::ResourceRecord* rr = dns::RRFactory::fromBuffer(buf, size, offset);
            if (rr == NULL)
            {
                std::cout << "Decode answer error, offset: " << offset << std::endl;
                bRet = false;
            }
            else
            {
                m_answers.push_back(rr);
            }
        }
        
        // In this implementation, we did not parse sections of authority and additional
        // so some data may be left in the buffer
        //assert(offset == size);
    }
    
    return bRet;
}
예제 #29
0
void ProtoMessage::clear()
{
	if (m_protoMsg == nullptr)
	{
		return;
	}
	m_protoMsg->Clear();
	clearMap();
	clearList();
	clearTable();
	m_key = -1;
	m_dataKey = -1;
}
예제 #30
0
FUNCTION int Q4ZM(obj user)
{
  int Q46D = 0x00;
  int Q4QG = 0x00;
  list Q5FD;
  clearList(Q5FD);
  getObjectsInRange(Q5FD, getLocation(user), 0x03);
  int Q5E6 = numInList(Q5FD);
  for(int i = 0x00; i < Q5E6; i ++)
  {
    int Q620 = getObjType(Q5FD[i]);
    switch(Q620)
    {
    case 0x0FAF:
    case 0x0FB0:
      Q46D = 0x01;
      break;
    case 0x0FB1:
      Q4QG = 0x01;
      break;
    }
    if(Q620 >= 0x197A)
    {
      if(Q620 <= 0x19A9)
      {
        Q4QG = 0x01;
      }
    }
  }
  if(!Q46D)
  {
    string Q47R = "You are not near an anvil";
    if(!Q4QG)
    {
      Q47R = Q47R + " or a forge.";
    }
    else
    {
      Q47R = Q47R + ".";
    }
    systemMessage(user, Q47R);
  }
  else
  {
    if(!Q4QG)
    {
      systemMessage(user, "You are not near a forge.");
    }
  }
  return(Q46D && Q4QG);
}