• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LIST_ADD函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LIST_ADD函数的典型用法代码示例。如果您正苦于以下问题:C++ LIST_ADD函数的具体用法?C++ LIST_ADD怎么用?C++ LIST_ADD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LIST_ADD函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: add_en_passant_captures

static void add_en_passant_captures(list_t * list, const board_t * board) {

   int from, to;
   int me;
   int inc;
   int pawn;

   ASSERT(list!=NULL);
   ASSERT(board!=NULL);

   to = board->ep_square;

   if (to != SquareNone) {

      me = board->turn;

      inc = PAWN_MOVE_INC(me);
      pawn = PAWN_MAKE(me);

      from = to - (inc-1);
      if (board->square[from] == pawn) {
         ASSERT(!SQUARE_IS_PROMOTE(to));
         LIST_ADD(list,MOVE_MAKE_FLAGS(from,to,MoveEnPassant));
      }

      from = to - (inc+1);
      if (board->square[from] == pawn) {
         ASSERT(!SQUARE_IS_PROMOTE(to));
         LIST_ADD(list,MOVE_MAKE_FLAGS(from,to,MoveEnPassant));
      }
   }
}
开发者ID:ZirconiumX,项目名称:fruitfly,代码行数:32,代码来源:move_gen.cpp


示例2: kill

 void kill(ipcw *w)
 {
     if (w >= (data+0) && w < (data + preallocated_bitems))
     {
         LIST_ADD((ipcwspace *)w, first, last, prev, next );
     } else
     {
         LIST_ADD((ipcwspace *)w, first_a, last_a, prev, next);
     }
 }
开发者ID:strogo,项目名称:Isotoxin,代码行数:10,代码来源:plghost.cpp


示例3: add_promote

void add_promote(list_t * list, int move) {

   ASSERT(list!=NULL);
   ASSERT(move_is_ok(move));

   ASSERT((move&~07777)==0); // HACK
   ASSERT(SQUARE_IS_PROMOTE(MOVE_TO(move)));

   LIST_ADD(list,move|MovePromoteQueen);
   LIST_ADD(list,move|MovePromoteKnight);
   LIST_ADD(list,move|MovePromoteRook);
   LIST_ADD(list,move|MovePromoteBishop);
}
开发者ID:ZirconiumX,项目名称:fruitfly,代码行数:13,代码来源:move_gen.cpp


示例4: _fill_zone_config

static void
_fill_zone_config(E_Zone               *zone,
                  E_Config_Dialog_Data *cfdata)
{
   E_Radio_Group *rg;
   Evas *evas = cfdata->evas;
   int i;

   /* Clear old entries first */
   evas_object_del(cfdata->o_desklist);
   cfdata->o_desklist = e_widget_list_add(evas, 1, 0);
   e_scrollframe_child_set(e_widget_scrollframe_object_get(cfdata->o_deskscroll), cfdata->o_desklist);
   e_widget_sub_object_add(cfdata->o_deskscroll, cfdata->o_desklist);

   for (i = 0; i < zone->desk_y_count * zone->desk_x_count; i++)
     {
        E_Desk *desk = zone->desks[i];
        if (!desk) continue;

        struct _E_Config_vdesk *vd = get_vdesk(cfdata, desk->x, desk->y, zone->num);
        if (!vd)
          {
             vd = malloc(sizeof(struct _E_Config_vdesk));
             vd->x = desk->x;
             vd->y = desk->y;
             vd->zone_num = zone->num;
             vd->layout = TILE_NONE;
             cfdata->vdesks = eina_list_append(cfdata->vdesks, vd);
          }

        rg = e_widget_radio_group_new(&(vd->layout));
        Evas_Object *radiolist = e_widget_list_add(evas, 0, 1);

        LIST_ADD(radiolist, e_widget_label_add(evas, desk->name));
        LIST_ADD(radiolist, RADIO("None", TILE_NONE, rg));
        LIST_ADD(radiolist, RADIO("Bigmain", TILE_BIGMAIN, rg));
        LIST_ADD(radiolist, RADIO("Grid", TILE_GRID, rg));
        LIST_ADD(cfdata->o_desklist, radiolist);
     }

   /* Get the correct sizes of desklist and scrollframe */
   int mw, mh;
   e_widget_size_min_get(cfdata->o_desklist, &mw, &mh);
   evas_object_resize(cfdata->o_desklist, mw, mh);
   if (mh > 150)
     mh = 150;
   mw += 32;
   mh += 32;
   e_widget_size_min_set(cfdata->o_deskscroll, mw, mh);
}
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:50,代码来源:e_mod_config.c


示例5: handle_fork

/* Log a fork system call.
 *
 * This will log the return value, but only if it's not 0 (i.e., is in
 * the parent). */
static void
handle_fork(struct filemon *fm, char op,
	    is_at_enum is_at __maybe_unused, struct pt_regs *regs)
{
#ifndef FILEMON_PERFORMANCE_NO_FORK_FM
	struct pid *pid;
#endif
	int scrv;
	scrv = syscall_get_return_value(current, regs);
	if (scrv == 0)		/* The < 0 case was already handled. */
		return;
	filemon_log(fm, op, "%i", scrv);

#ifndef FILEMON_PERFORMANCE_NO_FORK_FM
	/* List is already locked */
	pid = find_get_pid(scrv);
	if (pid >= 0) {
		struct fm_pids *s;
		s = kmalloc(sizeof(struct fm_pids), GFP_KERNEL);
		if (s) {
			s->pid = pid;
			LIST_ADD(&s->list, &fm->shead->list);
		}
	}
#endif
}
开发者ID:trixirt,项目名称:filemon-linux,代码行数:30,代码来源:syscalls.c


示例6: dfile_create

int dfile_create(char const *name, char const *path, int const flags, int const system)
{
	DFILE *df = dfile_malloc();

	if(!df)
		return (-1);

	dfile_init(df);
	LIST_ADD(l_dfile, df, sizeof(DFILE));
	df->state = dfsVirgin;
	strncpy(df->name, name, MAX_STRING-1);
	strncpy(df->path, path, 79);

	if(load_dfile(df, path, flags) != 0)
	{
		vmlog(8, "dfile_create: bad load on `%s', aborting.\n", path);
		LIST_REMOVE(l_dfile, df);
		FREE(df);
		return (-1);
	}

	if(system)
		df->flags |= DFS_SYSTEM;

	return (0);
}
开发者ID:dhanks,项目名称:jcd,代码行数:26,代码来源:dfile.c


示例7: PortCreateFile

status_t PortCreateFile(fsd_t *fsd, vnode_id_t dir, const wchar_t *name, 
                        void **cookie)
{
    port_fsd_t *pfsd;
    port_t *server;

    pfsd = (port_fsd_t*) fsd;
    assert(dir == VNODE_ROOT);

    //wprintf(L"PortCreateFile(%s)\n", name);

    server = malloc(sizeof(port_t));
    if (server == NULL)
        return errno;

    memset(server, 0, sizeof(port_t));
    server->is_server = true;
    server->u.server.name = _wcsdup(name);
    *cookie = server;

    SpinAcquire(&pfsd->sem);
    LIST_ADD(pfsd->server, server);
    SpinRelease(&pfsd->sem);

    return 0;
}
开发者ID:1tgr,项目名称:mobius,代码行数:26,代码来源:port.c


示例8: DEBUG_PRINT

int Sched::addtoactive(Task &task)
{
	Task *pos;
	uint8_t task_priority;
	task_priority = task.Task_GetSchedPriority();
	DEBUG_PRINT("addtoactive:task_priority:%d\n",task_priority);
	task.Task_SetState(TSTATE_TASK_READYTORUN);

	if (LIST_EMPTY(task_active)) {			// furtherm
		LIST_ADD(task_active, task);
		DEBUG_PRINT("LIST_EMPTY:LIST_ADD to task_active OK\n");
		Sched_SetCurrentTask(task);
		DEBUG_PRINT("It's the first task.\n");
		return OK;
	}else {

		if (LIST_LAST_ENTRY(task_active).Task_GetSchedPriority() > task_priority) {
			LIST_ADD_TAIL(task_active, task);
		}else {	
			LIST_FOR_EACH_ENTRY(task_active, pos) {
				if (pos->Task_GetSchedPriority() <= task_priority) {
					LIST_ADD_BEFORE(task_active, task, (*pos));
				}
			}
			if (!Sched_locked() && IS_LIST_FIRST_ENTRY(task_active, task)) {
				return OK;
			}
		}
	}
	return NO;
}
开发者ID:lhcalibur,项目名称:RTOS,代码行数:31,代码来源:add_to_active.cpp


示例9: add_piece_moves

static bool add_piece_moves(list_t * list, const board_t * board, int to, bool legal, bool stop) {

   int me;
   const sq_t * ptr;
   int from, piece;

   ASSERT(list!=NULL);
   ASSERT(board!=NULL);
   ASSERT(SQUARE_IS_OK(to));
   ASSERT(legal==true||legal==false);
   ASSERT(stop==true||stop==false);

   me = board->turn;

   for (ptr = &board->piece[me][1]; (from=*ptr) != SquareNone; ptr++) { // HACK: no king

      piece = board->square[from];

      if (PIECE_ATTACK(board,piece,from,to)) {
         if (!legal || !is_pinned(board,from,me)) {
            if (stop) return true;
            LIST_ADD(list,MOVE_MAKE(from,to));
         }
      }
   }

   return false;
}
开发者ID:Distrotech,项目名称:gnuchess,代码行数:28,代码来源:move_evasion.cpp


示例10: unvme_session_create

/**
 * Create a session and its associated queues.
 * @param   nsid        namespace id
 * @param   qcount      queue count
 * @param   qsize       queue size
 * @return  newly created session.
 */
static unvme_session_t* unvme_session_create(int nsid, int qcount, int qsize)
{
    DEBUG_FN("%x: nsid=%d qc=%d qs=%d",
             unvme_dev.vfiodev->pci, nsid, qcount, qsize);
    if ((nsid == 0 && (unvme_dev.ses || qcount != 1)) ||
        (nsid != 0 && !unvme_dev.ses)) FATAL("nsid %d", nsid);

    // allocate a session with its queue array
    unvme_session_t* ses = zalloc(sizeof(unvme_session_t) +
                                  sizeof(unvme_queue_t) * qcount);
    ses->queues = (unvme_queue_t*)(ses + 1);
    ses->qcount = qcount;
    ses->qsize = qsize;
    ses->masksize = ((qsize + 63) / 64) * sizeof(u64);

    if (pthread_spin_init(&ses->iomem.lock, PTHREAD_PROCESS_SHARED))
        FATAL("pthread_spin_init");

    LIST_ADD(unvme_dev.ses, ses);
    if (!nsid) {
        unvme_adminq_create(ses);
        unvme_ns_init(ses, nsid);
        DEBUG_FN("%x: adminq", unvme_dev.vfiodev->pci);
    } else {
        unvme_ns_init(ses, nsid);
        int i;
        for (i = 0; i < qcount; i++) unvme_ioq_create(ses, i);
        DEBUG_FN("%x: q=%d-%d bs=%d nb=%lu", unvme_dev.vfiodev->pci,
                 ses->id, ses->queues[qcount-1].id,
                 ses->ns.blocksize, ses->ns.blockcount);
    }

    return ses;
}
开发者ID:MicronSSD,项目名称:unvme,代码行数:41,代码来源:unvme_core.c


示例11: Node_add_sib

void Node_add_sib(Node *sib1, Node *sib2)
{
  assert_not(sib1, NULL);
  assert_not(sib2, NULL);

  LIST_ADD(Node, sib1, sib2, sibling);
  sib2->parent = sib1->parent;
}
开发者ID:dardevelin,项目名称:utu,代码行数:8,代码来源:node.c


示例12: Node_add_child

void Node_add_child(Node *parent, Node *child) 
{
  assert_not(parent, NULL);
  assert_not(child, NULL);

  LIST_ADD(Node, parent->child, child, sibling);
  child->parent = parent;
}
开发者ID:dardevelin,项目名称:utu,代码行数:8,代码来源:node.c


示例13: while

static void *gp_worker_main(void *pvt)
{
    struct gp_thread *t = (struct gp_thread *)pvt;
    struct gp_query *q = NULL;
    char dummy = 0;
    int ret;

    while (!t->pool->shutdown) {

        /* ======> COND_MUTEX */
        pthread_mutex_lock(&t->cond_mutex);
        while (t->query == NULL) {
            /* wait for next query */
            pthread_cond_wait(&t->cond_wakeup, &t->cond_mutex);
            if (t->pool->shutdown) {
                pthread_exit(NULL);
            }
        }

        /* grab the query off the shared pointer */
        q = t->query;
        t->query = NULL;

        /* <====== COND_MUTEX */
        pthread_mutex_unlock(&t->cond_mutex);

        /* handle the client request */
        gp_handle_query(t->pool, q);

        /* now get lock on main queue, to play with the reply list */
        /* ======> POOL LOCK */
        pthread_mutex_lock(&t->pool->lock);

        /* put back query so that dispatcher can send reply */
        q->next = t->pool->reply_list;
        t->pool->reply_list = q;

        /* add us back to the free list but only if we are not
         * shutting down */
        if (!t->pool->shutdown) {
            LIST_DEL(t->pool->busy_list, t);
            LIST_ADD(t->pool->free_list, t);
        }

        /* <====== POOL LOCK */
        pthread_mutex_unlock(&t->pool->lock);

        /* and wake up dispatcher so it will handle it */
        ret = write(t->pool->sig_pipe[1], &dummy, 1);
        if (ret == -1) {
            GPERROR("Failed to signal dispatcher!");
        }
    }

    pthread_exit(NULL);
}
开发者ID:frozencemetery,项目名称:gssproxy,代码行数:56,代码来源:gp_workers.c


示例14: add_pawn_move

void add_pawn_move(list_t * list, int from, int to) {

   int move;

   ASSERT(list!=NULL);
   ASSERT(SQUARE_IS_OK(from));
   ASSERT(SQUARE_IS_OK(to));

   move = MOVE_MAKE(from,to);

   if (SQUARE_IS_PROMOTE(to)) {
      LIST_ADD(list,move|MovePromoteQueen);
      LIST_ADD(list,move|MovePromoteKnight);
      LIST_ADD(list,move|MovePromoteRook);
      LIST_ADD(list,move|MovePromoteBishop);
   } else {
      LIST_ADD(list,move);
   }
}
开发者ID:ZirconiumX,项目名称:fruitfly,代码行数:19,代码来源:move_gen.cpp


示例15: svga_screen_cache_lookup

static INLINE struct svga_winsys_surface *
svga_screen_cache_lookup(struct svga_screen *svgascreen,
                         const struct svga_host_surface_cache_key *key)
{
   struct svga_host_surface_cache *cache = &svgascreen->cache;
   struct svga_winsys_screen *sws = svgascreen->sws;
   struct svga_host_surface_cache_entry *entry;
   struct svga_winsys_surface *handle = NULL;
   struct list_head *curr, *next;
   unsigned bucket;
   unsigned tries = 0;

   assert(key->cachable);

   bucket = svga_screen_cache_bucket(key);

   pipe_mutex_lock(cache->mutex);

   curr = cache->bucket[bucket].next;
   next = curr->next;
   while(curr != &cache->bucket[bucket]) {
      ++tries;
      
      entry = LIST_ENTRY(struct svga_host_surface_cache_entry, curr, bucket_head);

      assert(entry->handle);
      
      if(memcmp(&entry->key, key, sizeof *key) == 0 &&
         sws->fence_signalled( sws, entry->fence, 0 ) == 0) {
         assert(sws->surface_is_flushed(sws, entry->handle));
         
         handle = entry->handle; // Reference is transfered here.
         entry->handle = NULL;
         
         LIST_DEL(&entry->bucket_head);

         LIST_DEL(&entry->head);
         
         LIST_ADD(&entry->head, &cache->empty);

         break;
      }

      curr = next; 
      next = curr->next;
   }

   pipe_mutex_unlock(cache->mutex);
   
   if (SVGA_DEBUG & DEBUG_DMA)
      debug_printf("%s: cache %s after %u tries (bucket %d)\n", __FUNCTION__, 
                   handle ? "hit" : "miss", tries, bucket);
   
   return handle;
}
开发者ID:1065672644894730302,项目名称:Chromium,代码行数:55,代码来源:svga_screen_cache.c


示例16: add_castle_moves

static void add_castle_moves(list_t * list, const board_t * board) {

   ASSERT(list!=NULL);
   ASSERT(board!=NULL);

   ASSERT(!board_is_check(board));

   if (COLOUR_IS_WHITE(board->turn)) {

      if ((board->flags & FlagsWhiteKingCastle) != 0
       && board->square[F1] == Empty
       && board->square[G1] == Empty
       && !is_attacked(board,F1,Black)) {
         LIST_ADD(list,MOVE_MAKE_FLAGS(E1,G1,MoveCastle));
      }

      if ((board->flags & FlagsWhiteQueenCastle) != 0
       && board->square[D1] == Empty
       && board->square[C1] == Empty
       && board->square[B1] == Empty
       && !is_attacked(board,D1,Black)) {
         LIST_ADD(list,MOVE_MAKE_FLAGS(E1,C1,MoveCastle));
      }

   } else { // black

      if ((board->flags & FlagsBlackKingCastle) != 0
       && board->square[F8] == Empty
       && board->square[G8] == Empty
       && !is_attacked(board,F8,White)) {
         LIST_ADD(list,MOVE_MAKE_FLAGS(E8,G8,MoveCastle));
      }

      if ((board->flags & FlagsBlackQueenCastle) != 0
       && board->square[D8] == Empty
       && board->square[C8] == Empty
       && board->square[B8] == Empty
       && !is_attacked(board,D8,White)) {
         LIST_ADD(list,MOVE_MAKE_FLAGS(E8,C8,MoveCastle));
      }
   }
}
开发者ID:ZirconiumX,项目名称:fruitfly,代码行数:42,代码来源:move_gen.cpp


示例17: add_check

static void add_check(list_t * list, int move, board_t * board) {

    undo_t undo[1];

    ASSERT(list!=NULL);
    ASSERT(move_is_ok(move));
    ASSERT(board!=NULL);

    move_do(board,move,undo);
    if (IS_IN_CHECK(board,board->turn)) LIST_ADD(list,move);
    move_undo(board,move,undo);
}
开发者ID:renatolrr,项目名称:ChessDetection,代码行数:12,代码来源:move_check.cpp


示例18: RtlHandleRx

void RtlHandleRx(rtl8139_t *rtl)
{
    uint32_t ring_offs, rx_size, rx_status;
    rxpacket_t *packet;

    ring_offs = rtl->cur_rx % RX_BUF_LEN;
    rx_status = *(uint32_t*) (rtl->rx_ring + ring_offs);
    rx_size = rx_status >> 16;
    rx_status &= 0xffff;

    if ((rx_status & (RxBadSymbol | RxRunt | RxTooLong | RxCRCErr | RxBadAlign)) ||
        (rx_size < ETH_ZLEN) || 
        (rx_size > ETH_FRAME_LEN + 4))
    {
        wprintf(L"rx error 0x%x\n", rx_status);
        RtlReset(rtl);  /* this clears all interrupts still pending */
        RtlStartIo(rtl);
        return;
    }

    packet = malloc(sizeof(rxpacket_t) - 1 + rx_size - 4);
    if (packet == NULL)
        return;

    packet->length = rx_size - 4;   /* no one cares about the FCS */
    /* Received a good packet */
    if (ring_offs + 4 + rx_size - 4 > RX_BUF_LEN)
    {
        int semi_count = RX_BUF_LEN - ring_offs - 4;

        memcpy(packet->data, rtl->rx_ring + ring_offs + 4, semi_count);
        memcpy(packet->data + semi_count, rtl->rx_ring, rx_size - 4 - semi_count);
        //wprintf(L"rx packet %d+%d bytes", semi_count,rx_size - 4 - semi_count);
    }
    else
    {
        memcpy(packet->data, rtl->rx_ring + ring_offs + 4, packet->length);
        //wprintf(L"rx packet %d bytes", rx_size-4);
    }

    /*wprintf(L" at %X type %02X%02X rxstatus %hX\n",
        (unsigned long)(rtl->rx_ring + ring_offs+4),
        packet->data[12], packet->data[13], rx_status);*/

    packet->type = *(unsigned short*) (packet->data + 12);
    LIST_ADD(rtl->packet, packet);

    rtl->cur_rx = (rtl->cur_rx + rx_size + 4 + 3) & ~3;
    out16(rtl->iobase + RxBufPtr, rtl->cur_rx - 16);

    RtlStartIo(rtl);
}
开发者ID:1tgr,项目名称:mobius,代码行数:52,代码来源:rtl8139.c


示例19: iio_msg_done

/*
 * Returns:
 *  1 - If message is added to the retry queue.
 *  0 - If message is not added to the retry queue
 */
static int
iio_msg_done(struct qnio_msg *msg)
{
    struct iio_device *device = (struct iio_device*)msg->reserved;
    struct channel *channel = device->channel;
    int retry = 0;
    int do_failover = 0;
    int error;

    ck_spinlock_lock(&device->slock);
    device->active_msg_count --;
    error = msg->hinfo.err;
    if (error == QNIOERROR_HUP) {
        nioDbg("QNIOERROR_HUP received on msgid=%ld %p",msg->hinfo.cookie, msg);
        switch (device->state) {
        case IIO_DEVICE_ACTIVE:
            device->state = IIO_DEVICE_QUIESCE;
            /* Continue */

        case IIO_DEVICE_QUIESCE:
        case IIO_DEVICE_FAILOVER:
            device->retry_msg_count ++;
            device->active_msg_count ++;
            channel->cd->chdrv_msg_resend_cleanup(msg);
            LIST_ADD(&device->retryq, &msg->lnode);
            retry = 1;
            break;

        case IIO_DEVICE_FAILED:
            break;

        default:
            nioDbg("Unknown device state");
            break;
        }
    } else if (error) {
        nioDbg("message failed with error %d", error);
    }

    if (device->state == IIO_DEVICE_QUIESCE &&
        device->active_msg_count == device->retry_msg_count) {
        device->state = IIO_DEVICE_FAILOVER;
        do_failover = 1;
    }
    ck_spinlock_unlock(&device->slock);

    if (do_failover) {
        iio_device_failover(device);
    }

    return retry;
}
开发者ID:MittalAshish,项目名称:libqnio,代码行数:57,代码来源:iioapi.c


示例20: pool_buffer_destroy

static void
pool_buffer_destroy(struct pb_buffer *buf)
{
   struct pool_buffer *pool_buf = pool_buffer(buf);
   struct pool_pb_manager *pool = pool_buf->mgr;
   
   assert(!pipe_is_referenced(&pool_buf->base.reference));

   pipe_mutex_lock(pool->mutex);
   LIST_ADD(&pool_buf->head, &pool->free);
   pool->numFree++;
   pipe_mutex_unlock(pool->mutex);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:13,代码来源:pb_bufmgr_pool.c



注:本文中的LIST_ADD函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LIST_DATA函数代码示例发布时间:2022-05-30
下一篇:
C++ LIST函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap