item_t* joinitems(int size1, item_t *it1, int size2, item_t *it2) { item_t *items = createitems(size1+size2); memcpy (items->p, it1->p, size1*KNINT_SIZE); memcpy (items->w, it1->w, size1*KNINT_SIZE); memcpy (items->p+size1, it2->p, size2*KNINT_SIZE); memcpy (items->w+size1, it2->w, size2*KNINT_SIZE); return items; }
void SensorDialog::createButtons() { buttonBox = new QDialogButtonBox; closeButton = buttonBox->addButton(QDialogButtonBox::Close); helpButton = buttonBox->addButton(QDialogButtonBox::Help); createButton = buttonBox->addButton(tc->toUnicode("作成"),QDialogButtonBox::ActionRole); connect(createButton, SIGNAL(clicked()), this, SLOT(createitems())); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); }
int main(){ head_list_t *head = createlisthead(), *tail; item_t *items = createitems(1); *(items->p) = 1; *(items->w) = 10; additems(head, 1, items); items = createitems(2); *(items->p) = 2; *(items->p+1) = 3; *(items->w) = 9; *(items->w+1) = 8; node_list_t *node = createlistnode(); node->items = items; node->length = 2; addnode(head, node); tail = createlisthead(); items = createitems(3); *(items->p) = 4; *(items->p+1) = 5; *(items->p+2) = 6; *(items->w) = 7; *(items->w+1) = 6; *(items->w+2) = 5; additems(tail,3,items); addlist(head,tail); printf("list size is %d\n",head->count); print_list(head); tail->next = NULL; puts("free head"); fflush(stdout); free_list(&head); puts("free tail"); fflush(stdout); free_list(&tail); }
item_t* copyitems (int size, item_t *others) { item_t* r = createitems(size); memcpy (r->p,others->p,size*KNINT_SIZE); memcpy (r->w,others->w,size*KNINT_SIZE); return r; }