当前位置: 首页>>代码示例>>C++>>正文


C++ LIST_ADD函数代码示例

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


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


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