• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ reset_buf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PT_THREAD

static
PT_THREAD(generate_plugins(struct httpd_state *s))
{
  static sixlbr_plugin_info_t const *info;
  PSOCK_BEGIN(&s->sout);

  add("<h2>Plugins</h2>");
  add
    ("<table>"
     "<theader><tr class=\"row_first\"><td>Plugin ID</td><td>Description</td><td>Status</td><td>Version</td><td>Init</td><td>Status</td></tr></theader>"
     "<tbody>");
  SEND_STRING(&s->sout, buf);
  reset_buf();
  info = plugins_list_head();
  while(info != NULL) {
    add("<tr><td>%s</td><td>%s</td>", info->plugin->id, info->plugin->description);
    if(info->status == 0) {
      add("<td>Loaded</td><td>%s</td><td>%s</td><td>%s</td></tr>",
          info->plugin->version ? info->plugin->version() : "Unknown",
          info->init_status == 0 ? "Successful" : "Failed",
          info->plugin->status ? info->plugin->status() : "Unknown");
    } else {
      add("<td>Not loaded</td><td></td><td></td><td></td></tr>");
    }
    info = info->next;
    SEND_STRING(&s->sout, buf);
    reset_buf();
  }
  add("</tbody></table><br />");
  SEND_STRING(&s->sout, buf);
  reset_buf();
  PSOCK_END(&s->sout);
}
开发者ID:Scypho,项目名称:6lbr,代码行数:33,代码来源:webserver-admin.c


示例2: set_next_line

static int	set_next_line(t_buffer *buf, char *newline, char **line)
{
	char	*s;
	t_list	*chunk;
	size_t	new_size;

	if (newline)
	{
		new_size = buf->CHUNK_SIZE - (newline - (char *)buf->CHUNK) - 1;
		if (!(s = ft_strnew(new_size - 1)))
			return (reset_buf(buf, NULL));
		ft_memcpy(s, newline + 1, new_size);
		buf->CHUNK_SIZE -= new_size + 1;
		buf->size -= new_size + 1;
	}
	if (!(*line = ft_strnew(buf->size)))
		return (reset_buf(buf, &s));
	build_line(buf, *line);
	if (newline)
	{
		if (!(chunk = ft_lstnew(s, new_size)))
			return (reset_buf(buf, &s));
		ft_lstadd(&buf->chunks, chunk);
		buf->size = new_size;
	}
	return (1);
}
开发者ID:abouvier,项目名称:libft,代码行数:27,代码来源:get_next_line.c


示例3: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(generate_reboot(struct httpd_state *s))
{
#if BUF_USES_STACK
  char buf[BUF_SIZE];
#endif
  PSOCK_BEGIN(&s->sout);

  SEND_STRING(&s->sout, TOP);
  SEND_STRING(&s->sout,
              "<meta http-equiv=\"refresh\" content=\"2; url=/config.html\" />");
  SEND_STRING(&s->sout, BODY);
  reset_buf();
  add_div_home("Reboot");
  add("<div id=\"left_home\">");
  add("Restarting BR...<br />");
  add
    ("<a href=\"/config.html\">Click here if the page is not refreshing</a><br /><br />");
  add("</div>");
  SEND_STRING(&s->sout, buf);
  reset_buf();

  SEND_STRING(&s->sout, BOTTOM);

  process_post(&cetic_6lbr_process, 0, NULL);

  PSOCK_END(&s->sout);
}
开发者ID:TiagoLourenco,项目名称:6lbr,代码行数:29,代码来源:webserver.c


示例4: del_buf

void del_buf(size_t i) {
    char save[BUFSIZ];
    if (buf.i < 1) return;
    strncpy(save, buf.s, i);
    save[i] = '\0';
    reset_buf(save);
}
开发者ID:malleusinferni,项目名称:wry,代码行数:7,代码来源:wry.c


示例5: xstrdup

/* Turn string in buffer into string object. */
static object_t *parse_str (reader_t * r)
{
  size_t size = r->bufp - r->buf;
  char *str = xstrdup (r->buf);
  reset_buf (r);
  return c_str (str, size);
}
开发者ID:qyqx,项目名称:wisp,代码行数:8,代码来源:reader.c


示例6: _socket_fd

boss::Socket::Socket()
:  _socket_fd(INVALID_SOCKET)
{
    _error_text[0] = '\0';

    reset_buf();
}
开发者ID:QEver,项目名称:vosproj,代码行数:7,代码来源:reactor.cpp


示例7: append_buf

void append_buf(char c) {
    if (c == '\n') {
        break_at(buf.i);
        reset_buf("");
    } else {
        insert_ch(c);
        if (buf.i > WRAP_SIZE) {
            char save[BUFSIZ] = "";
            if (buf.inword) {
                // TODO Handle words too long to wrap
                strncpy(save, buf.s + buf.wbeg, buf.i - buf.wbeg);
                buf.wc--;
            }
            break_at(buf.wbreak);
            reset_buf(save);
        }
    }
}
开发者ID:malleusinferni,项目名称:wry,代码行数:18,代码来源:wry.c


示例8: reset

/* Remove top object from the sexp stack. */
static void reset (reader_t * r)
{
  r->done = 1;
  while (r->state != r->base)
    obj_destroy (pop (r));
  reset_buf (r);
  r->readbufp = r->readbuf;
  r->done = 0;
}
开发者ID:qyqx,项目名称:wisp,代码行数:10,代码来源:reader.c


示例9: strtol

/* Turn string in buffer into atom object. */
static object_t *parse_atom (reader_t * r)
{
  char *str = r->buf;
  char *end;

  /* Detect integer */
  int i = strtol (str, &end, 10);
  (void) i;
  if (end != str && *end == '\0')
    {
      object_t *o = c_ints (str);
      reset_buf (r);
      return o;
    }

  /* Detect float */
  int d = strtod (str, &end);
  (void) d;
  if (end != str && *end == '\0')
    {
      object_t *o = c_floats (str);
      reset_buf (r);
      return o;
    }

  /* Might be a symbol then */
  char *p = r->buf;
  while (p <= r->bufp)
    {
      if (strchr (atom_chars, *p) == NULL)
	{
	  char *errstr = xstrdup ("invalid symbol character: X");
	  errstr[strlen (errstr) - 1] = *p;
	  read_error (r, errstr);
	  xfree (errstr);
	  return NIL;
	}
      p++;
    }
  object_t *o = c_sym (r->buf);
  reset_buf (r);
  return o;
}
开发者ID:qyqx,项目名称:wisp,代码行数:44,代码来源:reader.c


示例10: read_status

/* reads the status of the device */
static void read_status(struct denali_nand_info *denali)
{
	uint32_t cmd = 0x0;

	/* initialize the data buffer to store status */
	reset_buf(denali);

	cmd = ioread32(denali->flash_reg + WRITE_PROTECT);
	if (cmd)
		write_byte_to_buf(denali, NAND_STATUS_WP);
	else
		write_byte_to_buf(denali, 0);
}
开发者ID:FEDEVEL,项目名称:imx6rex-linux-3.10.17,代码行数:14,代码来源:denali.c


示例11: get_next_line

int			get_next_line(int const fd, char **line)
{
	ssize_t			r;
	char			*n;
	char			*s;
	static t_buffer	buf;
	t_list			*chunk;

	r = 42;
	while (!buf.chunks
		|| (!(n = ft_memchr(buf.CHUNK, '\n', buf.CHUNK_SIZE)) && r))
	{
		if (!(s = ft_strnew(BUF_SIZE - 1))
			|| (r = read(fd, s, BUF_SIZE)) < 0
			|| !(chunk = ft_lstnew(s, r)))
			return (reset_buf(&buf, &s));
		ft_lstadd(&buf.chunks, chunk);
		buf.size += r;
	}
	if (buf.size)
		return (set_next_line(&buf, n, line));
	reset_buf(&buf, NULL);
	return (0);
}
开发者ID:abouvier,项目名称:libft,代码行数:24,代码来源:get_next_line.c


示例12: init_pw_area

/*
 * NAME:	init_pw_area
 *
 * DESCRIPTION: Initialize pre-write area to all zeros.
 *
 * PARAMETERS:	minor_t	      mnum      - minor number identity of metadevice
 *		md_dev64_t dev_to_write - index of column to resync
 *		int   column_index      - index of column to resync
 *
 * RETURN:	1 if write error on resync device, otherwise 0
 *
 * LOCKS:	Expects Unit Reader Lock to be held across call.
 */
int
init_pw_area(
	mr_unit_t *un,
	md_dev64_t dev_to_write,
	diskaddr_t pwstart,
	uint_t	col
)
{
	buf_t	buf;
	caddr_t	databuffer;
	size_t	copysize;
	size_t	bsize;
	int	error = 0;
	int	i;

	ASSERT(un != NULL);
	ASSERT(un->un_column[col].un_devflags & MD_RAID_DEV_ISOPEN);

	bsize = un->un_iosize;
	copysize = dbtob(bsize);
	databuffer = kmem_zalloc(copysize, KM_SLEEP);
	init_buf(&buf, (B_BUSY | B_WRITE), copysize);

	for (i = 0; i < un->un_pwcnt; i++) {
		/* magic field is 0 for 4.0 compatability */
		RAID_FILLIN_RPW(databuffer, un, 0, 0,
				0, 0, 0,
				0, col, 0);
		buf.b_un.b_addr = (caddr_t)databuffer;
		buf.b_edev = md_dev64_to_dev(dev_to_write);
		buf.b_bcount = dbtob(bsize);
		buf.b_lblkno = pwstart + (i * un->un_iosize);

		/* write buf */
		(void) md_call_strategy(&buf, MD_STR_NOTTOP, NULL);

		if (biowait(&buf)) {
			error = 1;
			break;
		}
		reset_buf(&buf, (B_BUSY | B_WRITE), copysize);
	} /* for */

	destroy_buf(&buf);
	kmem_free(databuffer, copysize);

	return (error);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:61,代码来源:raid_resync.c


示例13: denali_cmdfunc

static void denali_cmdfunc(struct mtd_info *mtd, unsigned int cmd, int col,
			   int page)
{
	struct denali_nand_info *denali = mtd_to_denali(mtd);
	uint32_t addr, id;
	int i;

	switch (cmd) {
	case NAND_CMD_PAGEPROG:
		break;
	case NAND_CMD_STATUS:
		read_status(denali);
		break;
	case NAND_CMD_READID:
	case NAND_CMD_PARAM:
		reset_buf(denali);
		/*sometimes ManufactureId read from register is not right
		 * e.g. some of Micron MT29F32G08QAA MLC NAND chips
		 * So here we send READID cmd to NAND insteand
		 * */
		addr = (uint32_t)MODE_11 | BANK(denali->flash_bank);
		index_addr(denali, (uint32_t)addr | 0, 0x90);
		index_addr(denali, (uint32_t)addr | 1, 0);
		for (i = 0; i < 5; i++) {
			index_addr_read_data(denali,
						(uint32_t)addr | 2,
						&id);
			write_byte_to_buf(denali, id);
		}
		break;
	case NAND_CMD_READ0:
	case NAND_CMD_SEQIN:
		denali->page = page;
		break;
	case NAND_CMD_RESET:
		reset_bank(denali);
		break;
	case NAND_CMD_READOOB:
		/* TODO: Read OOB data */
		break;
	default:
		printk(KERN_ERR ": unsupported command"
				" received 0x%x\n", cmd);
		break;
	}
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:46,代码来源:denali.c


示例14: denali_cmdfunc

static void denali_cmdfunc(struct mtd_info *mtd, unsigned int cmd, int col,
			   int page)
{
	struct denali_nand_info *denali = mtd_to_denali(mtd);
	uint32_t addr, id;
	int i;

	switch (cmd) {
	case NAND_CMD_PAGEPROG:
		break;
	case NAND_CMD_STATUS:
		read_status(denali);
		break;
	case NAND_CMD_READID:
	case NAND_CMD_PARAM:
		reset_buf(denali);
		addr = (uint32_t)MODE_11 | BANK(denali->flash_bank);
		index_addr(denali, (uint32_t)addr | 0, 0x90);
		index_addr(denali, (uint32_t)addr | 1, 0);
		for (i = 0; i < 5; i++) {
			index_addr_read_data(denali,
						(uint32_t)addr | 2,
						&id);
			write_byte_to_buf(denali, id);
		}
		break;
	case NAND_CMD_READ0:
	case NAND_CMD_SEQIN:
		denali->page = page;
		break;
	case NAND_CMD_RESET:
		reset_bank(denali);
		break;
	case NAND_CMD_READOOB:
		
		break;
	default:
		printk(KERN_ERR ": unsupported command"
				" received 0x%x\n", cmd);
		break;
	}
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:42,代码来源:denali.c


示例15: enable_rom

void SNES_SPC::reset_time_regs()
{
	cpu_error     = 0;
	echo_accessed = 0;
	spc_time      = 0;
	dsp_time      = 0;
	
	for ( int i = 0; i < timer_count; i++ )
	{
		Timer* t = &timers [i];
		t->next_time = 1;
		t->divider   = 0;
	}
	
	enable_rom( REGS [r_control] & 0x80 );
	timers_loaded();
	
	extra_clocks = 0;
	reset_buf();
}
开发者ID:yupferris,项目名称:snes_spc,代码行数:20,代码来源:SNES_SPC_misc.cpp


示例16: regs_loaded

void SNES_SPC::reset_time_regs()
{
	m.cpu_error     = 0;
	m.echo_accessed = 0;
	m.spc_time      = 0;
	m.dsp_time      = 0;
	#if SPC_LESS_ACCURATE
		m.dsp_time = clocks_per_sample + 1;
	#endif
	
	for ( int i = 0; i < timer_count; i++ )
	{
		Timer* t = &m.timers [i];
		t->next_time = 1;
		t->divider   = 0;
	}
	
	regs_loaded();
	
	m.extra_clocks = 0;
	reset_buf();
}
开发者ID:loveemu,项目名称:snsf9x,代码行数:22,代码来源:SNES_SPC_misc.cpp


示例17: fetch_hist_item

/* copies history item at hst_pos to line. Sets pos and len to the len of the history item.
   hst_pos is decremented or incremented depending on key_dir.

   resets line if at end of history */
void fetch_hist_item(ChatContext *ctx, int key_dir)
{
    if (key_dir == KEY_UP) {
        if (--ctx->hst_pos < 0) {
            ctx->hst_pos = 0;
            sound_notify(NULL, notif_error, NT_ALWAYS, NULL);
        }
    } else {
        if (++ctx->hst_pos >= ctx->hst_tot) {
            ctx->hst_pos = ctx->hst_tot;
            reset_buf(ctx);
            return;
        }
    }

    const wchar_t *hst_line = ctx->ln_history[ctx->hst_pos];
    size_t h_len = wcslen(hst_line);

    wmemcpy(ctx->line, hst_line, h_len + 1);
    ctx->pos = h_len;
    ctx->len = h_len;
}
开发者ID:Ansa89,项目名称:toxic,代码行数:26,代码来源:toxic_strings.c


示例18: require

void SNES_SPC::set_output( sample_t* out, int size )
{
	require( (size & 1) == 0 ); // size must be even
	
	m.extra_clocks &= clocks_per_sample - 1;
	if ( out )
	{
		sample_t const* out_end = out + size;
		m.buf_begin = out;
		m.buf_end   = out_end;
		
		// Copy extra to output
		sample_t const* in = m.extra_buf;
		while ( in < m.extra_pos && out < out_end )
			*out++ = *in++;
		
		// Handle output being full already
		if ( out >= out_end )
		{
			// Have DSP write to remaining extra space
			out     = dsp.extra();
			out_end = &dsp.extra() [extra_size];
			
			// Copy any remaining extra samples as if DSP wrote them
			while ( in < m.extra_pos )
				*out++ = *in++;
			assert( out <= out_end );
		}
		
		dsp.set_output( out, out_end - out );
	}
	else
	{
		reset_buf();
	}
}
开发者ID:loveemu,项目名称:snsf9x,代码行数:36,代码来源:SNES_SPC_misc.cpp


示例19: fetch_hist_item

/* copies history item at hst_pos to buf. Sets pos and len to the len of the history item.
   hst_pos is decremented or incremented depending on key_dir.
   
   resets buffer if at end of history */
void fetch_hist_item(wchar_t *buf, size_t *pos, size_t *len, wchar_t (*hst)[MAX_STR_SIZE],
                     int hst_tot, int *hst_pos, int key_dir)
{
    if (key_dir == MOVE_UP) {
        if (--(*hst_pos) < 0) {
            *hst_pos = 0;
            beep();
        }
    } else {
        if (++(*hst_pos) >= hst_tot) {
            *hst_pos = hst_tot;
            reset_buf(buf, pos, len);
            return;
        }
    }

    const wchar_t *hst_line = hst[*hst_pos];
    size_t h_len = wcslen(hst_line);

    wmemcpy(buf, hst_line, h_len + 1);

    *pos = h_len;
    *len = h_len;
}
开发者ID:Kuronogard,项目名称:toxic,代码行数:28,代码来源:toxic_strings.c


示例20: PT_THREAD

static
PT_THREAD(generate_statistics(struct httpd_state *s))
{
  PSOCK_BEGIN(&s->sout);

  add("<h2>IP</h2>");
#if UIP_STATISTICS
  add("<h3>IP</h3>");
  SEND_STRING(&s->sout, buf);
  reset_buf();
  PRINT_UIP_STAT( ip.recv, "Received packets" );
  PRINT_UIP_STAT( ip.sent, "Sent packets" );
  PRINT_UIP_STAT( ip.forwarded, "forwarded packets" );
  PRINT_UIP_STAT( ip.drop, "Dropped packets" );
  SEND_STRING(&s->sout, buf);
  reset_buf();
  PRINT_UIP_STAT( ip.vhlerr, "Wrong IP version or header length" );
  PRINT_UIP_STAT( ip.fragerr, "Dropped IP fragments" );
  PRINT_UIP_STAT( ip.chkerr, "Checksum errors" );
  PRINT_UIP_STAT( ip.protoerr, "Unsupported protocol" );
  add("<br />");
  SEND_STRING(&s->sout, buf);
  reset_buf();

  add("<h3>ICMP</h3>");
  PRINT_UIP_STAT( icmp.recv, "Received packets" );
  PRINT_UIP_STAT( icmp.sent, "Sent packets" );
  PRINT_UIP_STAT( icmp.drop, "Dropped packets" );
  PRINT_UIP_STAT( icmp.typeerr, "Unsupported type" );
  PRINT_UIP_STAT( ip.chkerr, "Checksum errors" );
  add("<br />");
  SEND_STRING(&s->sout, buf);
  reset_buf();

#if UIP_TCP
  add("<h3>TCP</h3>");
  PRINT_UIP_STAT( tcp.recv, "Received packets" );
  PRINT_UIP_STAT( tcp.sent, "Sent packets" );
  PRINT_UIP_STAT( tcp.drop, "Dropped packets" );
  PRINT_UIP_STAT( tcp.chkerr, "Checksum errors" );
  SEND_STRING(&s->sout, buf);
  reset_buf();
  PRINT_UIP_STAT( tcp.ackerr, "Ack errors" );
  PRINT_UIP_STAT( tcp.rst, "Received RST" );
  PRINT_UIP_STAT( tcp.rexmit, "retransmitted segments" );
  PRINT_UIP_STAT( tcp.syndrop, "Dropped SYNs" );
  PRINT_UIP_STAT( tcp.synrst, "SYNs for closed ports" );
  add("<br />");
  SEND_STRING(&s->sout, buf);
  reset_buf();
#endif
#if UIP_UDP
  add("<h3>UDP</h3>");
  PRINT_UIP_STAT( udp.recv, "Received packets" );
  PRINT_UIP_STAT( udp.sent, "Sent packets" );
  PRINT_UIP_STAT( udp.drop, "Dropped packets" );
  PRINT_UIP_STAT( udp.chkerr, "Checksum errors" );
  add("<br />");
  SEND_STRING(&s->sout, buf);
  reset_buf();
#endif
  add("<h3>NDP</h3>");
  PRINT_UIP_STAT( nd6.recv, "Received packets" );
  PRINT_UIP_STAT( nd6.sent, "Sent packets" );
  PRINT_UIP_STAT( nd6.drop, "Dropped packets" );
  add("<br />");
  SEND_STRING(&s->sout, buf);
  reset_buf();
#else
  add("<h3>IP statistics are deactivated</h3>");
#endif /* UIP_STATISTICS */
#if UIP_CONF_IPV6_RPL
  add("<h2>RPL</h2>");
#if RPL_CONF_STATS
  PRINT_RPL_STAT( mem_overflows, "Memory overflow");
  PRINT_RPL_STAT( local_repairs, "Local repairs");
  PRINT_RPL_STAT( global_repairs, "Global repairs");
  SEND_STRING(&s->sout, buf);
  reset_buf();
  PRINT_RPL_STAT( malformed_msgs, "Invalid packets");
  PRINT_RPL_STAT( resets, "DIO timer resets");
  PRINT_RPL_STAT( parent_switch, "Parent switch");
  SEND_STRING(&s->sout, buf);
  reset_buf();
  PRINT_RPL_STAT( forward_errors, "Forward errors");
  PRINT_RPL_STAT( loop_errors, "Loop errors");
  PRINT_RPL_STAT( loop_warnings, "Loop warnings");
  PRINT_RPL_STAT( root_repairs, "Root repairs");
  add("<br />");
  SEND_STRING(&s->sout, buf);
  reset_buf();
#else
  add("<h3>RPL statistics are deactivated</h3>");
#endif
#endif /* UIP_CONF_IPV6_RPL */
#if CETIC_CSMA_STATS

  add("<h2>CSMA</h2>");
  add("Allocated packets : %d<br />", csma_allocated_packets());
  add("Allocated neighbors : %d<br />", csma_allocated_neighbors());
//.........这里部分代码省略.........
开发者ID:Ayesha-N,项目名称:6lbr,代码行数:101,代码来源:webserver-statistics.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ reset_control_assert函数代码示例发布时间:2022-05-30
下一篇:
C++ resetView函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap