示例#1
0
文件: dump_buf.c 项目: JBarrada/fancy
void dump_buffer(uint8_t *buffer, int count) {
	draw_top_bar(0, (CNTRLDISPLAY){0, 0, 0, 0, 1});
	int i, xoffset=4, yoffset=34;
	char hex_buffer[10];
	for (i=0; i<count; i++) {
		memset(hex_buffer, 0, 10);
		sstring(hex_buffer, "%x", buffer[i]);
		putstr_small(xoffset, yoffset, hex_buffer, 1);
		xoffset += 16;
		
		if ((i+1)%16==0) {
			yoffset += 8;
			xoffset = 4;
		}
	}
	swap_buffers();
	uint16_t key;
	while (1) {
		key = get_key();
		switch (key) {
			case ESC_PRESSED:
				return;
		}
	}
}
示例#2
0
	swchar* string_cast<swchar*, schar>
		(const schar * value)
	{
		return string_cast<swchar*>(
			sstring(value)
			);
	}
示例#3
0
文件: ui.c 项目: JBarrada/fancy
void draw_text_prompt(char *text, char *buffer, int max_char) {
	int buf_loc = strlen(buffer);
	
	char prompt[100];
	memset(prompt, 0 ,100);
	sstring(prompt, "%s (%d:%d)", text, buf_loc, max_char);
	
	uint32_t prompt_px_width = get_str_width(prompt);
	uint32_t buffer_px_width = get_str_width_big(buffer);
	
	int box_height = 10 + 16 + 10 + 27 + 10;
	int box_width = ((prompt_px_width+20)>(buffer_px_width+20+10+6))?(prompt_px_width+20):(buffer_px_width+20+10+6);
	
	uint32_t absolute_x = (WIDTH_W/2) - (box_width/2);
	uint32_t absolute_y = (HEIGHT_W/2) - (box_height/2);
	
	rectangle_filled(absolute_x, absolute_y, box_width, box_height, 3+8);
	rectangle_filled(absolute_x+10, absolute_y+26 + 10, box_width - 20, 27, 4+8);
		
	putstr((WIDTH_W/2) - (prompt_px_width/2) , absolute_y + 10, prompt, 1+8);
	
	putstr_big(absolute_x+14, absolute_y+26 + 10 + 1, buffer, 1+8);
	putstr_big(absolute_x+14 + buffer_px_width, absolute_y+26 + 10 + 1, "_", 2+8);
	
	swap_buffers();
}
示例#4
0
文件: unix_util.c 项目: halhenke/Eve
void init_unix()
{
    signal(SIGPIPE, SIG_IGN);
    prf_heap = allocate_rolling(pages, sstring("prf"));
    select_init();
    init_processes();
}
示例#5
0
void W3CLog::trace(const Properties& prop)
{
	
	std::string buffer = "";

	std::vector<std::string>::iterator it = m_format.begin();

	while(it != m_format.end())
	{
		if(buffer != "")
		{
			buffer += " ";
		}

		if(*it == "date")
		{
			char date[100];
			_strdate(date);
			buffer += date;			
			it++;
			continue;
		}
		
		if(*it == "time")
		{
			char time[100];
			_strtime(time);
			buffer += time;			
			it++;
			continue;
		}
		if(sstring(*it).endsWith("-s"))
		{
			buffer += "\"";
		}
		buffer += prop.getProperty(*it);
		if(sstring(*it).endsWith("-s"))
		{
			buffer += "\"";
		}
		

		it++;
	}
	m_log->trace(buffer);
	
}
示例#6
0
void BigInteger::decodeDecimal(const std::string& str)
{
	int strLength = str.length();

	for(int i = 0 ; i < strLength  ; i++)
	{
		if((str[i] < 48)||(str[i] > 57))
			throw new exceptions::BigIntegerException(-1,"BigInteger::decodeDecimal() bad string format.");
	}

	
	BigInteger paso(1);	
	paso[0] = 0;
	BigInteger sumando(4);
	BigInteger diez(1);
	diez[0] = 10;
	for(i = 0 ; i < strLength - 1 ; i++)
	{
		unsigned long l = (unsigned long)sstring(str[i] - 48);
		sumando.m_buffer = (unsigned char*)&l;
		sumando.m_length = 4;

		paso = paso + sumando;
		paso = paso * diez;		

		sumando.m_buffer = 0;
	}

	unsigned long l = (unsigned long)sstring(str[strLength - 1] - 48);
	sumando.m_buffer = (unsigned char*)&l;
	sumando.m_length = 4;

	paso = paso + sumando;

	sumando.m_buffer = 0;

	*this = paso;
}