您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ENQUEUE函数代码示例

51自学网 2021-06-01 20:32:46
  C++
这篇教程C++ ENQUEUE函数代码示例写得很实用,希望能帮到您。

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

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

示例1: push_readyq

/* * Push 'task' onto the ready_tasks queue.  If 'task' has the privilege * flag set, then also push it onto the ready_priority_tasks queue. * * Caller must hold the task manager lock. */static inline voidpush_readyq(isc__taskmgr_t *manager, isc__task_t *task) {	ENQUEUE(manager->ready_tasks, task, ready_link);	if ((task->flags & TASK_F_PRIVILEGED) != 0)		ENQUEUE(manager->ready_priority_tasks, task,			ready_priority_link);}
开发者ID:execunix,项目名称:vinos,代码行数:13,


示例2: dijkstra

void dijkstra(struct Graph *G, int s) {    struct Queue* Q;    Q = (struct Queue*)malloc(sizeof(struct Queue));    Q->length = MAX_SIZE - 1;    Q->head = Q->tail = 0;    int i, j;    G->costArray[s] = 0;    ENQUEUE(Q, s);    while(Q->head!=Q->tail) {              j = DEQUEUE(Q);        G->colorArray[j] = BLACK;        for (i=1; i<=G->V; i++) {            if (G->adjMatrix[i][j]==0) {continue;} // Not j's neighbors            else {           //     if (G->colorArray[i]!=BLACK) { // Not j's parent                    if (G->costArray[i]==INFINITE) { // New node                        G->costArray[i] = G->costArray[j] + G->adjMatrix[i][j];                        G->parentArray[i] = j;                    }                    else if (G->costArray[i] > G->costArray[j] + G->adjMatrix[i][j]) { // Updated node                        G->costArray[i] = G->costArray[j] + G->adjMatrix[i][j];                        G->parentArray[i] = j;                    }                    ENQUEUE(Q, i);             //   }            }        }    }}
开发者ID:OrkoHunter,项目名称:algo-lab-records,代码行数:32,


示例3: AppMenuDoCommand

/* Perform menu command COMMAND.  */BooleanAppMenuDoCommand (UInt16 command){    Boolean handled = false;    FormDesc *fd;    /* See if menu command is a form switch.  */    for (fd = g_formList; fd; fd = fd->next) {        if (fd->menuCommandID == command) {            SwitchToForm (fd->formID);            return true;        }    }    /* Handle the rest of the items.  */    switch (command) {	case CommonOptionsPreferences:	    PrefShowSetupForm();	    return true;	    	case CommonOptionsAbout:	    AboutShow();	    return true;#if 0	case CommonOptionsSwitchclass:	    SPREF (bluetoothClass) = (SPREF (bluetoothClass) + 1) % 5;	    SPREF (bluetoothSDP) = (SPREF (bluetoothSDP) + 1) % 5;	    return true;#endif	case CommonConnectionAddDevice:	    BTSelectDevice();	    return true;	case CommonConnectionConnect:	    ENQUEUE (CmdInitiateConnect);	    return true;	case CommonConnectionDisconnect:	    ENQUEUE (CmdInitiateDisconnect);	    return true;	default:	    break;    }    return handled;}
开发者ID:fwindpeak,项目名称:blue-remote,代码行数:50,


示例4: Topologicalsort

void Topologicalsort( AdjGraph G, int aov[NumVertices] ){  	int v, w, nodes;	EdgeNode *tmp;	EdgeData indegree[NumVertices+1]={0};	QUEUE Q ;	MAKENULL( Q ) ;	// 计算每个顶点的入度	for( v=1; v<=G.n ; ++v )	{		tmp=G.vexlist[v].firstedge;		while(tmp)		{			indegree[tmp->adjvex]++;			tmp=tmp->next;		}		}	// 将入度为0的顶点加入队列	for(v=1; v<=G.n; ++v)		if ( indegree[v] ==0 ) 			ENQUEUE( v, Q ) ;		nodes = 0 ;	while ( !EMPTY( Q ) )	{  		v = FRONT(Q)->element ;		DEQUEUE( Q ) ;		//cout << v <<' '; 		aov[nodes]=v;		nodes ++ ;		// 已考虑的节点个数加1		// 如果(v, w)是一条边,将w的入度减1,如果w的入度为0,则将w入队		for( w=1; w<=G.n; w++) 		{			if(connect(G, v, w))			{				--indegree[w];				if( !(indegree[w])) 					ENQUEUE(w,Q) ;			}		}	}	cout<<endl;	if ( nodes < G.n ) 		cout<<"图中有环路"<<endl;	}
开发者ID:jiangxh1992,项目名称:Data-Structure-and-Algorithm,代码行数:48,


示例5: isc__task_setprivilege

ISC_TASKFUNC_SCOPE voidisc__task_setprivilege(isc_task_t *task0, isc_boolean_t priv) {	isc__task_t *task = (isc__task_t *)task0;	isc__taskmgr_t *manager = task->manager;	isc_boolean_t oldpriv;	LOCK(&task->lock);	oldpriv = ISC_TF((task->flags & TASK_F_PRIVILEGED) != 0);	if (priv)		task->flags |= TASK_F_PRIVILEGED;	else		task->flags &= ~TASK_F_PRIVILEGED;	UNLOCK(&task->lock);	if (priv == oldpriv)		return;	LOCK(&manager->lock);	if (priv && ISC_LINK_LINKED(task, ready_link))		ENQUEUE(manager->ready_priority_tasks, task,			ready_priority_link);	else if (!priv && ISC_LINK_LINKED(task, ready_priority_link))		DEQUEUE(manager->ready_priority_tasks, task,			ready_priority_link);	UNLOCK(&manager->lock);}
开发者ID:execunix,项目名称:vinos,代码行数:26,


示例6: arc_event_handler

/*Normal event handler.Take first character off queue and send to clock if not a null.Shift characters down and put a null on the end.We assume that there is no parallelism so no race condition, but evenif there is nothing bad will happen except that we might send some baddata to the clock once in a while.*/static voidarc_event_handler(	struct peer *peer	){	struct refclockproc *pp = peer->procptr;	register struct arcunit *up = (struct arcunit *)pp->unitptr;	int i;	char c;#ifdef DEBUG	if(debug > 2) { printf("arc: arc_event_handler() called./n"); }#endif	c = up->cmdqueue[0];       /* Next char to be sent. */	/* Shift down characters, shifting trailing /0 in at end. */	for(i = 0; i < CMDQUEUELEN; ++i)	{ up->cmdqueue[i] = up->cmdqueue[i+1]; }	/* Don't send '/0' characters. */	if(c != '/0') {		if(write(pp->io.fd, &c, 1) != 1) {			msyslog(LOG_NOTICE, "ARCRON: write to fd %d failed", pp->io.fd);		}#ifdef DEBUG		else if(debug) { printf("arc: sent `%2.2x', fd %d./n", c, pp->io.fd); }#endif	}	ENQUEUE(up);}
开发者ID:cyclops8456,项目名称:ntp,代码行数:41,


示例7: console_print

static fsm_rt_t console_print(const uint8_t *pchBuf,uint8_t chNum){    static uint8_t s_chPrintIndex ;    static enum {        CONSOLE_PRT_START = 0,        CONSOLE_PRT_PRINT    }s_tState = CONSOLE_PRT_START;        if((NULL == pchBuf) || (!chNum)) {        return fsm_rt_err;    }        switch(s_tState) {        case CONSOLE_PRT_START:            s_chPrintIndex = 0;            s_tState = CONSOLE_PRT_PRINT;            //break;                    case CONSOLE_PRT_PRINT:            if(s_chPrintIndex < chNum) {                if(ENQUEUE(InOutQueue,&g_tFIFOout,pchBuf[s_chPrintIndex])) {                    s_chPrintIndex++;                }            } else {                CONSOLE_PRT_RESET();                return fsm_rt_cpl;            }            break;    }        return fsm_rt_on_going;}
开发者ID:aixiaoxianggithub,项目名称:homework,代码行数:32,


示例8: task_send

static inline isc_boolean_ttask_send(isc_task_t *task, isc_event_t **eventp) {	isc_boolean_t was_idle = ISC_FALSE;	isc_event_t *event;	/*	 * Caller must be holding the task lock.	 */	REQUIRE(eventp != NULL);	event = *eventp;	REQUIRE(event != NULL);	REQUIRE(event->ev_type > 0);	REQUIRE(task->state != task_state_done);	XTRACE("task_send");	if (task->state == task_state_idle) {		was_idle = ISC_TRUE;		INSIST(EMPTY(task->events));		task->state = task_state_ready;	}	INSIST(task->state == task_state_ready ||	       task->state == task_state_running);	ENQUEUE(task->events, event, ev_link);	*eventp = NULL;	return (was_idle);}
开发者ID:OPSF,项目名称:uClinux,代码行数:29,


示例9: Assert

void TradeRouteData::SetRecip(TradeRoute route){	Assert(FALSE);	m_recip = route;	ENQUEUE();}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:8,


示例10: TTY_WriteByte

int TTY_WriteByte(int handle, byte data){	ComPort	*p;	p = handleToPort [handle];	if (FULL(p->outputQueue))		return -1;	ENQUEUE (p->outputQueue, data);	return 0;}
开发者ID:luaman,项目名称:qforge-nuq,代码行数:11,


示例11: Modem_Command

static int Modem_Command(ComPort *p, char *commandString){	byte	b;	if (CheckStatus (p))		return -1;	disable();	p->outputQueue.head = p->outputQueue.tail = 0;	p->inputQueue.head = p->inputQueue.tail = 0;	enable();	p->bufferUsed = 0;	while (*commandString)		ENQUEUE (p->outputQueue, *commandString++);	ENQUEUE (p->outputQueue, '/r');	// get the transmit rolling	DEQUEUE (p->outputQueue, b);	outportb(p->uart, b);	return 0;}
开发者ID:luaman,项目名称:qforge-nuq,代码行数:23,


示例12: processautorepeat

CARD32processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg){    xEvent kevent;    int    keycode;    keycode = (long)arg;    xf86Info.lastEventTime =	kevent.u.keyButtonPointer.time =	    GetTimeInMillis();    /*     * Repeat a key by faking a KeyRelease, and a KeyPress event in rapid     * succession     */    ENQUEUE(&kevent, keycode,  KeyRelease, XE_KEYBOARD);    ENQUEUE(&kevent, keycode,  KeyPress, XE_KEYBOARD);    /* And return the appropriate value so we get rescheduled */    return xf86Info.kbdRate;}
开发者ID:narenas,项目名称:nx-libs,代码行数:23,


示例13: GameObj

//----------------------------------------------------------------------------//// Name       : CivilisationData::CivilisationData//// Description: Constructor//// Parameters : id      : unique civilisation id//              owner   : player index//              civ     : civilisation index//              gender  : leader gender//// Globals    : -//// Returns    : -//// Remark(s)  : Notifies other (network) players of its existence.////----------------------------------------------------------------------------CivilisationData::CivilisationData(const ID &id, PLAYER_INDEX owner, sint32 civ, GENDER gender):	GameObj(id.m_id),	m_owner(owner),	m_civ(civ),	m_gender(gender),	m_cityStyle(CITY_STYLE_GENERIC){	memset(m_cityname_count, 0, sizeof(m_cityname_count));	memset(m_leader_name, 0, k_MAX_NAME_LEN);	memset(m_personality_description, 0, k_MAX_NAME_LEN);	memset(m_civilisation_name, 0, k_MAX_NAME_LEN);	memset(m_country_name, 0, k_MAX_NAME_LEN);	memset(m_singular_name, 0, k_MAX_NAME_LEN);	ENQUEUE();}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:34,


示例14: ISR_8250

static void ISR_8250 (ComPort *p){	byte	source = 0;	byte	b;	disable();	while((source = inportb (p->uart + INTERRUPT_ID_REGISTER) & 0x07) != 1)	{		switch (source)		{			case IIR_RX_DATA_READY_INTERRUPT:				b = inportb (p->uart + RECEIVE_BUFFER_REGISTER);				if (! FULL(p->inputQueue))				{					ENQUEUE (p->inputQueue, b);				}				else				{					p->lineStatus |= LSR_OVERRUN_ERROR;					p->statusUpdated = true;				}				break;			case IIR_TX_HOLDING_REGISTER_INTERRUPT:				if (! EMPTY(p->outputQueue))				{					DEQUEUE (p->outputQueue, b);					outportb (p->uart + TRANSMIT_HOLDING_REGISTER, b);				}				break;			case IIR_MODEM_STATUS_INTERRUPT:				p->modemStatus = (inportb (p->uart + MODEM_STATUS_REGISTER) & MODEM_STATUS_MASK) | p->modemStatusIgnore;				p->statusUpdated = true;				break;			case IIR_LINE_STATUS_INTERRUPT:				p->lineStatus = inportb (p->uart + LINE_STATUS_REGISTER);				p->statusUpdated = true;				break;		}		source = inportb (p->uart + INTERRUPT_ID_REGISTER) & 0x07;	}	outportb (0x20, 0x20);}
开发者ID:luaman,项目名称:qforge-nuq,代码行数:46,


示例15: task_ready

static inline voidtask_ready(isc_task_t *task) {	isc_taskmgr_t *manager = task->manager;	REQUIRE(VALID_MANAGER(manager));	REQUIRE(task->state == task_state_ready);	XTRACE("task_ready");	LOCK(&manager->lock);	ENQUEUE(manager->ready_tasks, task, ready_link);#ifdef ISC_PLATFORM_USETHREADS	SIGNAL(&manager->work_available);#endif /* ISC_PLATFORM_USETHREADS */	UNLOCK(&manager->lock);}
开发者ID:OPSF,项目名称:uClinux,代码行数:18,


示例16: isc__task_onshutdown

ISC_TASKFUNC_SCOPE isc_result_tisc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action,		     const void *arg){	isc__task_t *task = (isc__task_t *)task0;	isc_boolean_t disallowed = ISC_FALSE;	isc_result_t result = ISC_R_SUCCESS;	isc_event_t *event;	/*	 * Send a shutdown event with action 'action' and argument 'arg' when	 * 'task' is shutdown.	 */	REQUIRE(VALID_TASK(task));	REQUIRE(action != NULL);	event = isc_event_allocate(task->manager->mctx,				   NULL,				   ISC_TASKEVENT_SHUTDOWN,				   action,				   arg,				   sizeof(*event));	if (event == NULL)		return (ISC_R_NOMEMORY);	LOCK(&task->lock);	if (TASK_SHUTTINGDOWN(task)) {		disallowed = ISC_TRUE;		result = ISC_R_SHUTTINGDOWN;	} else		ENQUEUE(task->on_shutdown, event, ev_link);	UNLOCK(&task->lock);	if (disallowed)		isc_mem_put(task->manager->mctx, event, sizeof(*event));	return (result);}
开发者ID:2014-class,项目名称:freerouter,代码行数:39,


示例17: dequeue_events

static unsigned intdequeue_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,


示例18: task_shutdown

static inline isc_boolean_ttask_shutdown(isc__task_t *task) {	isc_boolean_t was_idle = ISC_FALSE;	isc_event_t *event, *prev;	/*	 * Caller must be holding the task's lock.	 */	XTRACE("task_shutdown");	if (! TASK_SHUTTINGDOWN(task)) {		XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,				      ISC_MSG_SHUTTINGDOWN, "shutting down"));		task->flags |= TASK_F_SHUTTINGDOWN;		if (task->state == task_state_idle) {			INSIST(EMPTY(task->events));			task->state = task_state_ready;			was_idle = ISC_TRUE;		}		INSIST(task->state == task_state_ready ||		       task->state == task_state_running);		/*		 * Note that we post shutdown events LIFO.		 */		for (event = TAIL(task->on_shutdown);		     event != NULL;		     event = prev) {			prev = PREV(event, ev_link);			DEQUEUE(task->on_shutdown, event, ev_link);			ENQUEUE(task->events, event, ev_link);		}	}	return (was_idle);}
开发者ID:execunix,项目名称:vinos,代码行数:37,


示例19: fore_buf_supply_1l

/* * Supply Strategy 1 Large Buffers to CP * * May be called in interrupt state. * Must be called with interrupts locked out. * * Arguments: *	fup		pointer to device unit structure * * Returns: *	none */static voidfore_buf_supply_1l(Fore_unit *fup){	H_buf_queue	*hbp;	Buf_queue	*cqp;	Buf_descr	*bdp;	Buf_handle	*bhp;	KBuffer		*m;	int		nvcc, nbuf, i;	/*	 * Figure out how many buffers we should be giving to the CP.	 * We're basing this calculation on the current number of open	 * VCCs thru this device, with certain minimum and maximum values	 * enforced.  This will then allow us to figure out how many more 	 * buffers we need to supply to the CP.  This will be rounded up 	 * to fill a supply queue entry.	 */	nvcc = MAX(fup->fu_open_vcc, BUF_MIN_VCC);	nbuf = nvcc * 4 * RECV_MAX_SEGS;	nbuf = MIN(nbuf, BUF1_LG_CPPOOL);	nbuf -= fup->fu_buf1l_cnt;	nbuf = roundup(nbuf, BUF1_LG_ENTSIZE);	/*	 * OK, now supply the buffers to the CP	 */	while (nbuf > 0) {		/*		 * Acquire a supply queue entry		 */		hbp = fup->fu_buf1l_tail;		if (!((*hbp->hbq_status) & QSTAT_FREE))			break;		bdp = hbp->hbq_descr;		/*		 * Get a buffer for each descriptor in the queue entry		 */		for (i = 0; i < BUF1_LG_ENTSIZE; i++, bdp++) {			caddr_t		cp;			/*			 * Get a cluster buffer			 */			KB_ALLOCEXT(m, BUF1_LG_SIZE, KB_F_NOWAIT, KB_T_DATA);			if (m == NULL) {				break;			}			KB_HEADSET(m, BUF1_LG_DOFF);			/*			 * Point to buffer handle structure			 */			bhp = (Buf_handle *)((caddr_t)m + BUF1_LG_HOFF);			bhp->bh_type = BHT_S1_LARGE;			/*			 * Setup buffer descriptor			 */			bdp->bsd_handle = bhp;			KB_DATASTART(m, cp, caddr_t);			bhp->bh_dma = bdp->bsd_buffer = (H_dma) DMA_GET_ADDR(				cp, BUF1_LG_SIZE, BUF_DATA_ALIGN, 0);			if (bdp->bsd_buffer == 0) {				/*				 * Unable to assign dma address - free up				 * this descriptor's buffer				 */				fup->fu_stats->st_drv.drv_bf_segdma++;				KB_FREEALL(m);				break;			}			/*			 * All set, so queue buffer (handle)			 */			ENQUEUE(bhp, Buf_handle, bh_qelem, fup->fu_buf1l_bq);		}		/*		 * If we we're not able to fill all the descriptors for		 * an entry, free up what's been partially built		 */		if (i != BUF1_LG_ENTSIZE) {			caddr_t		cp;//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,


示例20: ISR_16550

static void ISR_16550 (ComPort *p){	int		count;	byte	source;	byte	b;	disable();	while((source = inportb (p->uart + INTERRUPT_ID_REGISTER) & 0x07) != 1)	{		switch (source)		{			case IIR_RX_DATA_READY_INTERRUPT:				do				{					b = inportb (p->uart + RECEIVE_BUFFER_REGISTER);					if (!FULL(p->inputQueue))					{						ENQUEUE (p->inputQueue, b);					}					else					{						p->lineStatus |= LSR_OVERRUN_ERROR;						p->statusUpdated = true;					}				} while (inportb (p->uart + LINE_STATUS_REGISTER) & LSR_DATA_READY);				break;			case IIR_TX_HOLDING_REGISTER_INTERRUPT:				count = 16;				while ((! EMPTY(p->outputQueue)) && count--)				{					DEQUEUE (p->outputQueue, b);					outportb (p->uart + TRANSMIT_HOLDING_REGISTER, b);				}				break;			case IIR_MODEM_STATUS_INTERRUPT:				p->modemStatus = (inportb (p->uart + MODEM_STATUS_REGISTER) & MODEM_STATUS_MASK) | p->modemStatusIgnore;				p->statusUpdated = true;				break;			case IIR_LINE_STATUS_INTERRUPT:				p->lineStatus = inportb (p->uart + LINE_STATUS_REGISTER);				p->statusUpdated = true;				break;		}		source = inportb (p->uart + INTERRUPT_ID_REGISTER) & 0x07;	}	// check for lost IIR_TX_HOLDING_REGISTER_INTERRUPT on 16550a!	if (inportb (p->uart + LINE_STATUS_REGISTER ) & LSR_TRANSMITTER_EMPTY)	{		count = 16;		while ((! EMPTY(p->outputQueue)) && count--)		{			DEQUEUE (p->outputQueue, b);			outportb (p->uart + TRANSMIT_HOLDING_REGISTER, b);		}	}	outportb (0x20, 0x20);}
开发者ID:luaman,项目名称:qforge-nuq,代码行数:62,


示例21: ENQUEUE

void TradeRouteData::SetDestination(Unit dest){	m_destinationCity = dest;	ENQUEUE();}
开发者ID:jleclanche,项目名称:darkdust-ctp2,代码行数:5,


示例22: arc_start

//.........这里部分代码省略.........	}#ifndef SYS_WINNT	fcntl(fd, F_SETFL, 0); /* clear the descriptor flags */#endif#ifdef DEBUG	if(debug)	{ printf("arc: opened RS232 port with file descriptor %d./n", fd); }#endif#ifdef HAVE_TERMIOS	tcgetattr(fd, &arg);	arg.c_iflag = IGNBRK | ISTRIP;	arg.c_oflag = 0;	arg.c_cflag = B300 | CS8 | CREAD | CLOCAL | CSTOPB;	arg.c_lflag = 0;	arg.c_cc[VMIN] = 1;	arg.c_cc[VTIME] = 0;	tcsetattr(fd, TCSANOW, &arg);#else	msyslog(LOG_ERR, "ARCRON: termios not supported in this driver");	(void)close(fd);	return 0;#endif	up = emalloc(sizeof(*up));	/* Set structure to all zeros... */	memset(up, 0, sizeof(*up));	pp = peer->procptr;	pp->io.clock_recv = arc_receive;	pp->io.srcclock = (caddr_t)peer;	pp->io.datalen = 0;	pp->io.fd = fd;	if (!io_addclock(&pp->io)) {		close(fd);		pp->io.fd = -1;		free(up); 		return(0); 	}	pp->unitptr = (caddr_t)up;	/*	 * Initialize miscellaneous variables	 */	peer->precision = PRECISION;	peer->stratum = 2;              /* Default to stratum 2 not 0. */	pp->clockdesc = DESCRIPTION;	if (peer->MODE > 3) {		msyslog(LOG_NOTICE, "ARCRON: Invalid mode %d", peer->MODE);		return 0;	}#ifdef DEBUG	if(debug) { printf("arc: mode = %d./n", peer->MODE); }#endif	switch (peer->MODE) {	    case 1:		memcpy((char *)&pp->refid, REFID_MSF, 4);		break;	    case 2:		memcpy((char *)&pp->refid, REFID_DCF77, 4);		break;	    case 3:		memcpy((char *)&pp->refid, REFID_WWVB, 4);		break;	    default:		memcpy((char *)&pp->refid, REFID, 4);		break;	}	/* Spread out resyncs so that they should remain separated. */	up->next_resync = current_time + INITIAL_RESYNC_DELAY + (67*unit)%1009;#if 0 /* Not needed because of zeroing of arcunit structure... */	up->resyncing = 0;              /* Not resyncing yet. */	up->saved_flags = 0;            /* Default is all flags off. */	/* Clear send buffer out... */	{		int i;		for(i = CMDQUEUELEN; i >= 0; --i) { up->cmdqueue[i] = '/0'; }	}#endif#ifdef ARCRON_KEEN	up->quality = QUALITY_UNKNOWN;  /* Trust the clock immediately. */#else	up->quality = MIN_CLOCK_QUALITY;/* Don't trust the clock yet. */#endif	peer->action = arc_event_handler;	ENQUEUE(up);	return(1);}
开发者ID:cyclops8456,项目名称:ntp,代码行数:101,


示例23: os2PostKbdEvent

//.........这里部分代码省略.........		case XK_Num_Lock:			lockkeys &= ~NUMFLAG;			break;		case XK_Scroll_Lock:			lockkeys &= ~SCROLLFLAG;			break;		}		if (keysym[1] == XF86XK_ModeLock)			lockkeys &= ~MODEFLAG;	}	/*	 * LockKey special handling:	 * ignore releases, toggle on & off on presses.	 * Don't deal with the Caps_Lock keysym directly, 	 * but check the lock modifier	 */#ifndef PC98	if (keyc->modifierMap[keycode] & LockMask ||	    keysym[0] == XK_Scroll_Lock ||	    keysym[1] == XF86XK_ModeLock ||	    keysym[0] == XK_Num_Lock) {		Bool flag;		if (!down) return;		flag = !KeyPressed(keycode);		if (!flag) down = !down;		if (keyc->modifierMap[keycode] & LockMask)			xf86Info.capsLock = flag;		if (keysym[0] == XK_Num_Lock)			xf86Info.numLock = flag;		if (keysym[0] == XK_Scroll_Lock)			xf86Info.scrollLock = flag;		if (keysym[1] == XF86XK_ModeLock)			xf86Info.modeSwitchLock = flag;		updateLeds = TRUE;	}#endif /* not PC98 */		/* normal, non-keypad keys */	if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {		/* magic ALT_L key on AT84 keyboards for multilingual support */		if (xf86Info.kbdType == KB_84 &&		    ModifierDown(AltMask) &&		    keysym[2] != NoSymbol) {			UsePrefix = TRUE;			Direction = TRUE;		}	}#ifdef XKB /* Warning: got position wrong first time */	}#endif	/* check for an autorepeat-event */	if ((down && KeyPressed(keycode)) &&	    (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode]))		return;	xf86Info.lastEventTime = 		kevent.u.keyButtonPointer.time = 		GetTimeInMillis();	/*	 * And now send these prefixes ...	 * NOTE: There cannot be multiple Mode_Switch keys !!!!	 */	if (UsePrefix) {		ENQUEUE(&kevent,			keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],			Direction ? KeyPress : KeyRelease,			XE_KEYBOARD);		ENQUEUE(&kevent, 			keycode, 			down ? KeyPress : KeyRelease,			XE_KEYBOARD);		ENQUEUE(&kevent,			keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],			Direction ? KeyRelease : KeyPress,			XE_KEYBOARD);	} else {#ifdef XFreeDGA		if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectKeyb) {			XF86DirectVideoKeyEvent(&kevent, 						keycode,						down ? KeyPress : KeyRelease);		} else#endif		{			ENQUEUE(&kevent,				keycode,				down ? KeyPress : KeyRelease,				XE_KEYBOARD);		}	}	if (updateLeds) xf86KbdLeds();}
开发者ID:marioaugustorama,项目名称:tropix-xwindow,代码行数:101,


示例24: main

int main(){    tipofilalancamento inicio, fim;    tipo_equipe_OK topo;    struct equipe equipe;    struct equipe_OK equipe_OK;    int cont = 1, lancamento_bem_sucedido = 1;        init(&inicio,&fim);     init_lista_sucesso(&topo);        while (cont == 1) {        printf("Entre com o nome da equipe:/n");        gets(equipe.nome);        equipe.tentativas = 0;                ENQUEUE(&inicio, &fim, equipe);        printf("/nDeseja cadastrar mais equipes?/n");        printf("(/"1/" = SIM, quero cadastrar mais equipes / /"0/" = NAO, quero iniciar os lancamentos)/n");        scanf("%d", &cont);    }        while (!IsEmpty(inicio, fim)) {          if (FIRST(inicio, fim, &equipe) == 1) {             printf("Lancamento da Equipe /"%s/"", equipe.nome);             printf("/n");             printf("Entre com os dados do lancamento:/n/n");             printf("Lancamento bem sucedido? (/"1/" = SIM / /"0/" = NAO): ");             scanf("%d",&lancamento_bem_sucedido);             if (lancamento_bem_sucedido == 1) {                printf("/n");                printf("Entre com a distancia do alvo: ");                scanf("%d", &equipe_OK.distancia_do_alvo);                printf("/n");                printf("Entre com o tempo de propulsao (em s): ");                scanf("%f", &equipe_OK.tempo_de_propulsao);                printf("/n");                                PUSH(&topo, equipe);                                printf("/nConfirmacao: Equipe /"%s/" | Tempo de propulsao: %d | Distancia do alvo: %f", &equipe_OK.nome, &equipe_OK.tempo_de_propulsao, &equipe_OK.distancia_do_alvo);                                DEQUEUE(&inicio, &fim, &equipe);             } else {                equipe.tentativas += 1;                if (equipe.tentativas == 2) {                    DEQUEUE(&inicio, &fim, &equipe);                    printf("Equipe desclassificada após 2 tentativas sem sucesso/n");                }             }                          scanf("%d", &cont);             printf("/n");          }    }      cont = 1;    while (cont != 0) {        printf("Fim dos lan
C++ ENSURE函数代码示例
C++ ENGINE_set_name函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。