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


C++ NEXT函数代码示例

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


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

示例1: PlayerTrail_PickFirst

edict_t *
PlayerTrail_PickFirst(edict_t *self)
{
	int marker;
	int n;

	if (!self)
	{
		return NULL;
	}

	if (!trail_active)
	{
		return NULL;
	}

	for (marker = trail_head, n = TRAIL_LENGTH; n; n--)
	{
		if (trail[marker]->timestamp <= self->monsterinfo.trail_time)
		{
			marker = NEXT(marker);
		}
		else
		{
			break;
		}
	}

	if (visible(self, trail[marker]))
	{
		return trail[marker];
	}

	if (visible(self, trail[PREV(marker)]))
	{
		return trail[PREV(marker)];
	}

	return trail[marker];
}
开发者ID:basecq,项目名称:q2dos,代码行数:40,代码来源:p_trail.c

示例2: screen_read_close

static void screen_read_close(void)
{
	unsigned i, j;
	int vcsa_fd;
	char *data;

	// Close & re-open vcsa in case they have swapped virtual consoles
	vcsa_fd = xopen(G.vcsa_name, O_RDONLY);
	xread(vcsa_fd, &G.remote, 4);
	i = G.remote.cols * 2;
	G.first_line_offset = G.y * i;
	i *= G.remote.lines;
	if (G.data == NULL) {
		G.size = i;
		G.data = xzalloc(2 * i);
	}
	if (G.size != i) {
		cleanup(EXIT_FAILURE);
	}
	data = G.data + G.current;
	xread(vcsa_fd, data, G.size);
	close(vcsa_fd);
	for (i = 0; i < G.remote.lines; i++) {
		for (j = 0; j < G.remote.cols; j++, NEXT(data)) {
			unsigned x = j - G.x; // if will catch j < G.x too
			unsigned y = i - G.y; // if will catch i < G.y too

			if (y >= G.height || x >= G.width)
				DATA(data) = 0;
			else {
				uint8_t ch = CHAR(data);
				if (ch < ' ')
					CHAR(data) = ch | 0x40;
				else if (ch > 0x7e)
					CHAR(data) = '?';
			}
		}
	}
}
开发者ID:android-ide,项目名称:busybox,代码行数:39,代码来源:conspy.c

示例3: bigobject_rfc3986_segment

/**
 * bigobject_rfc3986_segment:
 * @str:  the string to analyze
 * @forbid: an optional forbidden character
 * @empty: allow an empty segment
 *
 * Parse a segment and fills in the appropriate fields
 * of the @uri structure
 *
 * segment       = *pchar
 * segment-nz    = 1*pchar
 * segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
 *               ; non-zero-length segment without any colon ":"
 *
 * Returns 0 or the error code
 */
static int
bigobject_rfc3986_segment(const char **str, char forbid, int empty)
{
        const char *cur = NULL;
        int ret         = 0;

        if (str == NULL) {
                ret = -1;
                goto out;
        }
        cur = *str;
        if (!ISA_PCHAR(cur)) {
                if (!empty)
                        ret = 1;
                goto out;
        }
        while (ISA_PCHAR(cur) && (*cur != forbid))
                NEXT(cur);
        *str = cur;
out:
        return ret;
}
开发者ID:harshavardhana,项目名称:BigObjects,代码行数:38,代码来源:uri.c

示例4: grow_table

static void
grow_table(isc_symtab_t *symtab) {
	eltlist_t *newtable;
	unsigned int i, newsize, newmax;

	REQUIRE(symtab != NULL);

	newsize = symtab->size * 2;
	newmax = newsize * 3 / 4;
	INSIST(newsize > 0U && newmax > 0U);

	newtable = isc_mem_get(symtab->mctx, newsize * sizeof(eltlist_t));
	if (newtable == NULL)
		return;

	for (i = 0; i < newsize; i++)
		INIT_LIST(newtable[i]);

	for (i = 0; i < symtab->size; i++) {
		elt_t *elt, *nelt;

		for (elt = HEAD(symtab->table[i]); elt != NULL; elt = nelt) {
			unsigned int hv;

			nelt = NEXT(elt, link);

			UNLINK(symtab->table[i], elt, link);
			hv = hash(elt->key, symtab->case_sensitive);
			APPEND(newtable[hv % newsize], elt, link);
		}
	}

	isc_mem_put(symtab->mctx, symtab->table,
		    symtab->size * sizeof(eltlist_t));

	symtab->table = newtable;
	symtab->size = newsize;
	symtab->maxload = newmax;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:39,代码来源:symtab.c

示例5: int

struct lf_ordlist *lf_ordlist_create(size_t nbrelm,
				     int (*cmp)(void *a, void *b))
{
	struct lf_ordlist *lst;

	lst = calloc(1, sizeof(*lst));
	if (!lst)
		return NULL;
	lst->cmp = cmp;
	lst->nelms = nbrelm + 2;

	lst->fl = mem_freelist_create(lst->nelms, 1,
				      sizeof(struct lf_ordlist_node));
	if (!lst->fl)
		goto err_fl;

	lst->head = mem_new(lst->fl);
	if (!lst->head)
		goto err_head;

	lst->tail = mem_new(lst->fl);
	if (!lst->tail)
		goto err_tail;

	mem_incr_ref(lst->tail);
	NEXT(lst->head) = (struct node *) lst->tail;

	return lst;

err_tail:
	mem_release(lst->fl, lst->head);

err_head:
	mem_freelist_destroy(lst->fl);

err_fl:
	free(lst);
	return NULL;
}
开发者ID:eaburns,项目名称:pbnf,代码行数:39,代码来源:ordlist_harris.c

示例6: inner_statement_any

void  inner_statement_any(OID v2548,OID v1741,OID v332)
{ GC_BIND;
  if (INHERIT(OWNER(v2548),Language._Do))
   { list * v1732 = GC_OBJECT(list,OBJECT(Do,v2548)->args);
    int  v1733 = v1732->length;
    ClaireBoolean * v1722 = Optimize.OPT->alloc_stack;
    int  v1734 = 0;
    (Optimize.OPT->alloc_stack = CFALSE);
    { ITERATE(v1744);
      for (START(v1732); NEXT(v1744);)
      { ++v1734;
        if (v1734 == v1733)
         { (Optimize.OPT->alloc_stack = v1722);
          inner_statement_any(v1744,v1741,v332);
          } 
        else if (boolean_I_any(v1744) == CTRUE)
         inner_statement_any(v1744,_oid_(Kernel.emptySet),v332);
        } 
      } 
    } 
  else statement_any(v2548,v1741,v332);
    GC_UNBIND;} 
开发者ID:ycaseau,项目名称:CLAIRE3.3,代码行数:22,代码来源:gstat.cpp

示例7: blKillPDB

/*>PDB *blDeleteAtomPDB(PDB *pdb, PDB *atom)
   -----------------------------------------
*//**
   \param[in]     *pdb    Start of PDB linked list
   \param[in]     *atom   Atom to delete
   \return                New start of PDB linked list

   Deletes an atom from the PDB linked list. Should be called as 
   pdb=blDeleteAtomPDB(pdb, atom);
   to allow for the first atom in the linked list being deleted.

   Returns NULL of all atoms have been deleted. Returns the input
   pdb linked list unmodified if the atom isn't found.

-  17.03.15  Original   By: ACRM
*/
PDB *blDeleteAtomPDB(PDB *pdb, PDB *atom)
{
   PDB *p, 
       *next,
       *prev=NULL;

   for(p=pdb; p!=NULL; NEXT(p))
   {
      if(p==atom)
      {
         next = blKillPDB(atom, prev);
         /* Killed atom from start of linked list                       */
         if(prev==NULL)
            return(next);
         return(pdb);
      }
      
      prev=p;
   }

   return(pdb);
}
开发者ID:SavOK,项目名称:bioplib,代码行数:38,代码来源:KillPDB.c

示例8: dequeue_events

static unsigned int
dequeue_events(isc_task_t *task, void *sender, isc_eventtype_t first,
	       isc_eventtype_t last, void *tag,
	       isc_eventlist_t *events, isc_boolean_t purging)
{
	isc_event_t *event, *next_event;
	unsigned int count = 0;

	REQUIRE(VALID_TASK(task));
	REQUIRE(last >= first);

	XTRACE("dequeue_events");

	/*
	 * Events matching 'sender', whose type is >= first and <= last, and
	 * whose tag is 'tag' will be dequeued.  If 'purging', matching events
	 * which are marked as unpurgable will not be dequeued.
	 *
	 * sender == NULL means "any sender", and tag == NULL means "any tag".
	 */

	LOCK(&task->lock);

	for (event = HEAD(task->events); event != NULL; event = next_event) {
		next_event = NEXT(event, ev_link);
		if (event->ev_type >= first && event->ev_type <= last &&
		    (sender == NULL || event->ev_sender == sender) &&
		    (tag == NULL || event->ev_tag == tag) &&
		    (!purging || PURGE_OK(event))) {
			DEQUEUE(task->events, event, ev_link);
			ENQUEUE(*events, event, ev_link);
			count++;
		}
	}

	UNLOCK(&task->lock);

	return (count);
}
开发者ID:OPSF,项目名称:uClinux,代码行数:39,代码来源:task.c

示例9: etherrxflush

int
etherrxflush(int ctlrno)
{
	int n;
	Ether *ctlr;
	RingBuf *ring;

	if((ctlr = attach(ctlrno)) == 0)
		return 0;

	n = 0;
	for(;;){
		ring = &ctlr->rb[ctlr->rh];
		if(wait(ring, Interface, 100) == 0)
			break;

		ring->owner = Interface;
		ctlr->rh = NEXT(ctlr->rh, ctlr->nrb);
		n++;
	}

	return n;
}
开发者ID:Akheon23,项目名称:nix-os,代码行数:23,代码来源:ether.c

示例10: NEXT

/*
 ==================
 SG_ClientTrail_PickFirst
 ==================
*/
edict_t *SG_ClientTrail_PickFirst (edict_t *self){

	int		marker;
	int		i;

	if (!trailActive)
		return NULL;

	for (marker = trailHead, i = TRAIL_LENGTH; i; i--){
		if (trail[marker]->timestamp <= self->monsterinfo.trail_time)
			marker = NEXT(marker);
		else
			break;
	}

	if (SG_IsEntityVisible(self, trail[marker]))
		return trail[marker];

	if (SG_IsEntityVisible(self, trail[PREV(marker)]))
		return trail[PREV(marker)];

	return trail[marker];
}
开发者ID:Mirrorman95,项目名称:quake-2-evolved,代码行数:28,代码来源:sg_clientTrail.c

示例11: alloc_new_string

INLINE_STATIC block_t *
alloc_new_string (const char * string, int h)
{
    block_t *b;
    int len = strlen(string);
    int size;

    if (len > max_string_length) {
        len = max_string_length;
    }
    size = sizeof(block_t) + len + 1;
    b = (block_t *) DXALLOC(size, TAG_SHARED_STRING, "alloc_new_string");
    strncpy(STRING(b), string, len);
    STRING(b)[len] = '\0';      /* strncpy doesn't put on \0 if 'from' too
                                 * long */
    SIZE(b) = (len > USHRT_MAX ? USHRT_MAX : len);
    REFS(b) = 1;
    NEXT(b) = base_table[h];
    base_table[h] = b;
    ADD_NEW_STRING(SIZE(b), sizeof(block_t));
    ADD_STRING(SIZE(b));
    return (b);
}
开发者ID:Yuffster,项目名称:fluffOS,代码行数:23,代码来源:stralloc.c

示例12: p_b_coll_elem

/*
 - p_b_coll_elem - parse a collating-element name and look it up
 */
static char			/* value of collating element */
p_b_coll_elem(struct parse *p,
    int endc)			/* name ended by endc,']' */
{
	char *sp = p->next;
	struct cname *cp;
	int len;

	while (MORE() && !SEETWO(endc, ']'))
		NEXT();
	if (!MORE()) {
		SETERROR(REG_EBRACK);
		return(0);
	}
	len = p->next - sp;
	for (cp = cnames; cp->name != NULL; cp++)
		if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
			return(cp->code);	/* known name */
	if (len == 1)
		return(*sp);	/* single character */
	SETERROR(REG_ECOLLATE);			/* neither */
	return(0);
}
开发者ID:OPSF,项目名称:uClinux,代码行数:26,代码来源:regcomp.c

示例13: toringbuf

static void
toringbuf(Ether* edev, uint8_t* data, int len)
{
	RingBuf *rb;
	extern int interesting(void*);

	if(!interesting(data))
		return;

	rb = &edev->rb[edev->ri];
	if(rb->owner == Interface){
		if(len > sizeof(rb->pkt))
			len = sizeof(rb->pkt);
		rb->len = len;
		memmove(rb->pkt, data, rb->len);
		rb->owner = Host;
		edev->ri = NEXT(edev->ri, edev->nrb);
	}
	else if(debug){
		print("#l%d: toringbuf: dropping packets @ ri %d\n",
			edev->ctlrno, edev->ri);
	}
}
开发者ID:npe9,项目名称:harvey,代码行数:23,代码来源:ethervgbe.c

示例14: play_buffer

static void inline play_buffer(void){
#ifndef THREADED_AUDIO
	// We should wait for the other buffer to finish its DMA transfer first
	while( AUDIO_GetDMABytesLeft() );
	AUDIO_StopDMA();

#else // THREADED_AUDIO
	// Wait for a sample to actually be played to work around a deadlock
	LWP_SemWait(first_audio);
	
	// This thread will keep giving buffers to the audio as they come
	while(thread_running){

	// Wait for a buffer to be processed
	LWP_SemWait(buffer_full);
#endif

	// Make sure the buffer is in RAM, not the cache
	DCFlushRange(buffer[thread_buffer], buffer_size);

	// Actually send the buffer out to be played next
	AUDIO_InitDMA((unsigned int)&buffer[thread_buffer], buffer_size);

#ifdef THREADED_AUDIO
	// Wait for the audio interface to be free before playing
	LWP_SemWait(audio_free);
#endif

	// Start playing the buffer
	AUDIO_StartDMA();

#ifdef THREADED_AUDIO
	// Move the index to the next buffer
	NEXT(thread_buffer);
	}
#endif
}
开发者ID:DusterTheThief2,项目名称:mupen64gc,代码行数:37,代码来源:audio.c

示例15: xlat_promote_to_old_space

/**
 * Promote a block in temp space (or elsewhere for that matter) to old space.
 *
 * @param block to promote.
 */
static void xlat_promote_to_old_space( xlat_cache_block_t block )
{
    int allocation = (int)-sizeof(struct xlat_cache_block);
    int size = block->size;
    xlat_cache_block_t curr = xlat_old_cache_ptr;
    xlat_cache_block_t start_block = curr;
    do {
        allocation += curr->size + sizeof(struct xlat_cache_block);
        curr = NEXT(curr);
        if( allocation > size ) {
            break; /* done */
        }
        if( curr->size == 0 ) { /* End-of-cache Sentinel */
            /* Leave what we just released as free space and start again from the
             * top of the cache
             */
            start_block->active = 0;
            start_block->size = allocation;
            allocation = (int)-sizeof(struct xlat_cache_block);
            start_block = curr = xlat_old_cache;
        }
    } while(1);
    start_block->active = 1;
    start_block->size = allocation;
    start_block->lut_entry = block->lut_entry;
    start_block->chain = block->chain;
    start_block->fpscr_mask = block->fpscr_mask;
    start_block->fpscr = block->fpscr;
    start_block->recover_table_offset = block->recover_table_offset;
    start_block->recover_table_size = block->recover_table_size;
    *block->lut_entry = &start_block->code;
    memcpy( start_block->code, block->code, block->size );
    xlat_old_cache_ptr = xlat_cut_block(start_block, size );
    if( xlat_old_cache_ptr->size == 0 ) {
        xlat_old_cache_ptr = xlat_old_cache;
    }
}
开发者ID:PASAf,项目名称:lxdream,代码行数:42,代码来源:xltcache.c


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