本文整理汇总了C++中NEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ NEXT函数的具体用法?C++ NEXT怎么用?C++ NEXT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NEXT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: file
/*>char *blGetTitleWholePDB(WHOLEPDB *wpdb)
----------------------------------------
*//**
\param[in] *wpdb WHOLEPDB structure
\return Tit;le from PDB file (malloc()'d)
Extracts the title from a PDB file malloc()ing a string in which to
store the data. This must be freed by user code
- 28.04.15 Original By: ACRM
- 11.05.15 Return NULL if TITLE line absent. By: CTP
- 09.06.15 Add columns 11 to 80 to title string for both start and
continuation lines. By: CTP
*/
char *blGetTitleWholePDB(WHOLEPDB *wpdb)
{
char *title = NULL,
*cleanTitle = NULL;
STRINGLIST *s;
BOOL inTitle = FALSE;
for(s=wpdb->header; s!=NULL; NEXT(s))
{
if(!strncmp(s->string, "TITLE ", 6))
{
char buffer[MAXPDBANNOTATION];
strcpy(buffer, s->string);
TERMINATE(buffer);
/* append cols 11-80 to title string */
title = blStrcatalloc(title, buffer+10);
if(title == NULL)
return(NULL);
}
else if(inTitle)
{
break;
}
}
/* title line not found */
if(title == NULL)
return(NULL);
cleanTitle = blCollapseSpaces(title);
free(title);
KILLTRAILSPACES(cleanTitle);
return(cleanTitle);
}
开发者ID:frederic-mahe,项目名称:bioplib,代码行数:51,代码来源:PDBHeaderInfo.c
示例17: txstart
static void
txstart(Ether* ether)
{
Ctlr *ctlr;
Block *bp;
Des *des;
int control;
ctlr = ether->ctlr;
while(ctlr->ntq < (ctlr->ntdr-1)){
if(ctlr->setupbp){
bp = ctlr->setupbp;
ctlr->setupbp = 0;
control = Ic|Set|BLEN(bp);
}
else{
bp = qget(ether->oq);
if(bp == nil)
break;
control = Ic|Lseg|Fseg|BLEN(bp);
}
ctlr->tdr[PREV(ctlr->tdrh, ctlr->ntdr)].control &= ~Ic;
des = &ctlr->tdr[ctlr->tdrh];
des->bp = bp;
des->addr = PCIWADDR(bp->rp);
des->control |= control;
ctlr->ntq++;
coherence();
des->status = Own;
csr32w(ctlr, 1, 0);
ctlr->tdrh = NEXT(ctlr->tdrh, ctlr->ntdr);
}
if(ctlr->ntq > ctlr->ntqmax)
ctlr->ntqmax = ctlr->ntq;
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:37,代码来源:ether2114x.c
示例18: GET_ALLOC
/*
* coalesce - Coalesce adjacent free blocks. Sort the new free block into the
* appropriate list.
*/
static void *coalesce(void *ptr)
{
size_t prev_alloc = GET_ALLOC(HEAD(PREV(ptr)));
size_t next_alloc = GET_ALLOC(HEAD(NEXT(ptr)));
size_t size = GET_SIZE(HEAD(ptr));
/* Return if previous and next blocks are allocated */
if (prev_alloc && next_alloc) {
return ptr;
}
/* Do not coalesce with previous block if it is tagged */
if (GET_TAG(HEAD(PREV(ptr))))
prev_alloc = 1;
/* Remove old block from list */
delete_node(ptr);
/* Detect free blocks and merge, if possible */
if (prev_alloc && !next_alloc) {
delete_node(NEXT(ptr));
size += GET_SIZE(HEAD(NEXT(ptr)));
PUT(HEAD(ptr), PACK(size, 0));
PUT(FOOT(ptr), PACK(size, 0));
} else if (!prev_alloc && next_alloc) {
delete_node(PREV(ptr));
size += GET_SIZE(HEAD(PREV(ptr)));
PUT(FOOT(ptr), PACK(size, 0));
PUT(HEAD(PREV(ptr)), PACK(size, 0));
ptr = PREV(ptr);
} else {
delete_node(PREV(ptr));
delete_node(NEXT(ptr));
size += GET_SIZE(HEAD(PREV(ptr))) + GET_SIZE(HEAD(NEXT(ptr)));
PUT(HEAD(PREV(ptr)), PACK(size, 0));
PUT(FOOT(NEXT(ptr)), PACK(size, 0));
ptr = PREV(ptr);
}
/* Adjust segregated linked lists */
insert_node(ptr, size);
return ptr;
}
开发者ID:bloveless,项目名称:malloclab,代码行数:48,代码来源:mm_ref0.c
示例19: verify_hash_table
void *hash_next(void *_hash_table, struct hash_iterator *i)
{
struct hash_table *t = _hash_table;
unsigned int index;
verify_hash_table(t);
restart:
if(!i->ptr) {
for(index = (unsigned int)(i->bucket + 1); index < t->table_size; index++) {
if(t->table[index]) {
i->bucket = index;
i->ptr = t->table[index];
break;
}
}
} else {
i->ptr = NEXT(t, i->ptr);
if(!i->ptr)
goto restart;
}
return i->ptr;
}
开发者ID:NoSuchProcess,项目名称:phantomuserland,代码行数:24,代码来源:khash.c
示例20: while
void *ft_alg(void *p)
{
t_env *e;
int i;
e = (t_env *)p;
i = e->id;
while (e->roll != 3)
{
never_die(e, i);
if (!ft_strcmp(e->state[NEXT(i)], THINK) &&
!ft_strcmp(e->state[PREV(i)], THINK))
try_both(e, i);
else if (TRY(&e->lock[FI]) == 0)
ft_try(e, FI, NI, i);
else if (TRY(&e->lock[NI]) == 0)
ft_try(e, NI, FI, i);
else
ft_rest(e, i, 0);
}
if (pthread_detach(e->th[i]))
ft_putendl("Error while detaching thread");
return (p);
}
开发者ID:Sequoya42,项目名称:turbulent-octo-broccoli,代码行数:24,代码来源:philosopher.c
注:本文中的NEXT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论