當前位置: 首頁>>代碼示例>>C++>>正文


C++ EI函數代碼示例

本文整理匯總了C++中EI函數的典型用法代碼示例。如果您正苦於以下問題:C++ EI函數的具體用法?C++ EI怎麽用?C++ EI使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了EI函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ei_x_encode_error_tuple_atom

int ei_x_encode_error_tuple_atom(ei_x_buff *buff, char *atom) {
    EI(ei_x_encode_version(buff));
    EI(ei_x_encode_tuple_header(buff, 2));
    EI(ei_x_encode_atom(buff, "error"));
    EI(ei_x_encode_atom(buff, atom));
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:7,代碼來源:ei_util.c

示例2: k_set_prio

int
k_set_prio (char prio)
{
    int i;

    if (!k_running) {
        return (-1);
    }

    DI ();

    if ((prio <= 0) || (DMY_PRIO <= prio)) {
        // not legal value my friend
        EI ();
        return (-2);
    }
    i = pRun->prio;

    pRun->prio = prio;
    prio_enQ (pAQ, deQ (pRun));
    ki_task_shift ();

    EI ();

    return (i);
}
開發者ID:carycode,項目名稱:krnl,代碼行數:26,代碼來源:krnl.c

示例3: imalloc

/*
 * Get memory 
 */
LOCAL void* imalloc( size_t size, IMACB *imacb )
{
	QUEUE	*q;
	VP	mem;
	UW	imask;

	/* If it is smaller than the minimum fragment size,
	   allocate the minimum size to it. */
	if ( size < MIN_FRAGMENT ) {
		size = MIN_FRAGMENT;
	}
	size = ROUND(size);

	DI(imask);  /* Exclusive control by interrupt disable */
	SpinLock(&MemLockObj);

	/* Search FreeQue */
	q = searchFreeArea(size, imacb);
	if ( q != &imacb->freeque ) {
		/* There is free area: Split from FreeQue once */
		removeFreeQue(q);

		q = q - 1;
	} else {
		/* Reserve new pages because there is no free space */
		QUEUE	*e;
		size_t	n;

		/* Reserve pages */
		SpinUnlock(&MemLockObj);
		EI(imask);
		n = PageCount(size + sizeof(QUEUE) * 2);
		q = GetSysMemBlk(n, imacb->mematr);
		if ( q == NULL ) {
			goto err_ret;  /* Insufficient memory */
		}
		DI(imask);
		SpinLock(&MemLockObj);

		/* Register on AreaQue */
		e = (QUEUE*)((VB*)q + n * pagesz) - 1;
		insertAreaQue(&imacb->areaque, e);
		insertAreaQue(&imacb->areaque, q);
		setAreaFlag(q, AREA_TOP);
		setAreaFlag(e, AREA_END);
	}

	/* Allocate memory */
	mem = mem_alloc(q, size, imacb);

	SpinUnlock(&MemLockObj);
	EI(imask);
	return mem;

err_ret:
	BMS_DEBUG_PRINT(("imalloc error\n"));
	return NULL;
}
開發者ID:kidasan,項目名稱:tkernel,代碼行數:61,代碼來源:imalloc.c

示例4: ei_x_encode_time

int ei_x_encode_time(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
    EI(ei_x_encode_atom(types, "time"));
    int v = r->i;
    if(opts->day_seconds_is_q_time) {
        v = msec_to_sec(v);
    }
    EI(ei_x_encode_ki_val(values, v));
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:9,代碼來源:q2e.c

示例5: ei_x_encode_kstring

int ei_x_encode_kstring(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
    EI(ei_x_encode_atom(types, "string"));
    if(r->n == 0) {
        EI(ei_x_encode_empty_list(values));
    } else {
        EI(ei_x_encode_string_len(values, (const char*)kC(r), r->n));
    }
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:9,代碼來源:q2e.c

示例6: ei_x_encode_dict_impl

int ei_x_encode_dict_impl(ei_x_buff* types, ei_x_buff* values, const char* t, K r, QOpts* opts) {
    EI(ei_x_encode_tuple_header(types, r->n+1));
    EI(ei_x_encode_atom(types, t));
    EI(ei_x_encode_tuple_header(values, r->n));
    int i;
    for(i=0; i<r->n; ++i) {
        EI(ei_x_encode_k_tv(types, values, kK(r)[i], opts));
    }
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:10,代碼來源:q2e.c

示例7: ei_x_encode_unknown

int ei_x_encode_unknown(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
    EI(ei_x_encode_tuple_header(types, r->n+1));
    EI(ei_x_encode_long(types, r->t));
    EI(ei_x_encode_tuple_header(values, r->n));
    int i;
    for(i=0; i<r->n; ++i) {
        EI(ei_x_encode_k_tv(types, values, kK(r)[i], opts));
    }
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:10,代碼來源:q2e.c

示例8: ei_x_encode_datetime

int ei_x_encode_datetime(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
    if(opts->unix_timestamp_is_q_datetime) {
        long v = datetime_to_unix_timestamp(r->f);
        EI(ei_x_encode_atom(types, "datetime"));
        EI(ei_x_encode_long(values, v));
    } else {
        EI(ei_x_encode_kf(types, values, "datetime", r, opts));
    }
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:10,代碼來源:q2e.c

示例9: ei_x_encode_same_list_byte

int ei_x_encode_same_list_byte(ei_x_buff* types, ei_x_buff* values, const char* t, K r, QOpts* opts) {
    EI(ei_x_encode_tuple_header(types, 2));
    EI(ei_x_encode_atom(types, "list"));
    EI(ei_x_encode_atom(types, t));
    if(r->n == 0) {
        EI(ei_x_encode_empty_list(values));
    } else {
        EI(ei_x_encode_string_len(values, (const char*)kG(r), r->n));
    }
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:11,代碼來源:q2e.c

示例10: _SifCmdIntHandler

int _SifCmdIntHandler()
{
	u128 packet[8];
	u128 *pktbuf;
	struct cmd_data *cmd_data = &_sif_cmd_data;
	SifCmdHeader_t *header;
	SifCmdHandlerData_t *cmd_handlers;
	int size, pktquads, id, i = 0;

	EI();

	header = (SifCmdHeader_t *)cmd_data->pktbuf;

	if (!(size = (header->size & 0xff)))
		goto out;

	/* TODO: Don't copy anything extra */
	pktquads = (size + 30) >> 4;
	header->size = 0;
	if (pktquads) {
		pktbuf = (u128 *)cmd_data->pktbuf;
		while (pktquads--) {
			packet[i] = pktbuf[i];
			i++;
		}
	}

	iSifSetDChain();

	header = (SifCmdHeader_t *)packet;
	/* Get the command handler id and determine which handler list to
	   dispatch from.  */
	id = header->cid & ~SYSTEM_CMD;

	if (id < CMD_HANDLER_MAX) {
		if (header->cid & SYSTEM_CMD) {
			cmd_handlers = cmd_data->sys_cmd_handlers;
		}
		else {
			cmd_handlers = cmd_data->usr_cmd_handlers;
		}
	} else {
		goto out;
	}

	if (cmd_handlers[id].handler)
		cmd_handlers[id].handler(packet, cmd_handlers[id].harg);

out:
	EE_SYNC();
	EI();
	return 0;
}
開發者ID:EvertonSilva,項目名稱:ps2sdk,代碼行數:53,代碼來源:sifcmd.c

示例11: ei_x_encode_kf_val

int ei_x_encode_kf_val(ei_x_buff* values, double f) {
    EI_X_ENCODE_NULL_OR_INF(f, nf, wf);
    if(f == nf || q2e_isnan(f)) {
        EI(ei_x_encode_atom(values, "null"));
        return 0;
    } else if(f == wf) {
        EI(ei_x_encode_atom(values, "infinity"));
        return 0;
    }
    EI(ei_x_encode_double(values, f));
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:12,代碼來源:q2e.c

示例12: ei_x_encode_k

int ei_x_encode_k(ei_x_buff* x, K r, QOpts* opts) {
    EI(ei_x_encode_tuple_header(x, 2));
    ei_x_buff* types = x;
    ei_x_buff values;
    EI(ei_x_new(&values));
    EIC(ei_x_encode_k_tv(types, &values, r, opts),
            ei_x_free(&values)); // cleanup expression
    // TODO - JMS - is there a way to do this without deep copying data?
    EIC(ei_x_append(types, &values),
            ei_x_free(&values)); // cleanup expression
    EI(ei_x_free(&values));
    return 0;
}
開發者ID:csurface,項目名稱:gen_q,代碼行數:13,代碼來源:q2e.c

示例13: main

int main(){
	DI();//disable interrupts or hell breaks loose during hardware config
	construct_system();//bind device addresses
	init_system();//init devices
		//clear all interrupts
	clearall_interrupts();
	EI();//enable interrupts: we have UART_recieve
	
	//set the lcd contrast
	//lcd_contrast(0x42);
	lcd_contrast(0x32);
	//clear the lcd
	clearram();
	//show boot up message
	show_bootup();
	//clear boot message
	clearram();
	//screen layout
	screen_layout();
	send(1, 225);
	send(1, 255);
	send(1, 2);
	while(1)
	{
		get_temperature1();
		get_temperature2();
		get_light();
		get_pressure();
		get_humidity();
		get_soilwetness();
		display();
		delay_ms(800);		
	}
	return 0;
}
開發者ID:Muriukidavid,項目名稱:z8_64k,代碼行數:35,代碼來源:main.c

示例14: uart_putchar

int uart_putchar(unsigned char c)
{
    int buffer_loc;

    if(c == '\n') {
        while(uart_putchar('\r')) {
            ;
        }
    }

    if(trans_buffer_size < BUFFER_SIZE) {
        DI();

        buffer_loc = (trans_buffer_current + trans_buffer_size) % BUFFER_SIZE;
        trans_buffer[buffer_loc] = c;
        trans_buffer_size++;

        //trigger the interrupt if already ready to transmit
        if((U0STAT0 & UART_TRAN_RDY) &&
                ((IRQ0SET & UART_IRQ_TRAN) == 0)) {
            IRQ0SET |= UART_IRQ_TRAN;
        }

        EI();
    }
    else {
        return 1;
    }

    return 0;
}
開發者ID:mharlan,項目名稱:embedded-labs,代碼行數:31,代碼來源:uart.c

示例15: knl_Ifree

/*
 * Free memory
 *	It may be called during interrupt disable. In this case, need to wait
 *	 until interrupt is enabled and until free.
 */
EXPORT void  knl_Ifree( void *ptr )
{
	QUEUE	*aq;
	UINT	imask;

	DI(imask);  /* Exclusive control by interrupt disable */

	aq = (QUEUE*)ptr - 1;
	clrAreaFlag(aq, AREA_USE);

	if ( !chkAreaFlag(aq->next, AREA_USE) ) {
		/* Merge with free area in after location */
		knl_removeFreeQue(aq->next + 1);
		knl_removeAreaQue(aq->next);
	}

	if ( !chkAreaFlag(aq->prev, AREA_USE) ) {
		/* Merge with free area in front location */
		aq = aq->prev;
		knl_removeFreeQue(aq + 1);
		knl_removeAreaQue(aq->next);
	}

	knl_appendFreeArea(knl_imacb, aq);

	EI(imask);
}
開發者ID:chenyifu,項目名稱:utkernel-pi,代碼行數:32,代碼來源:memory.c


注:本文中的EI函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。