当前位置: 首页>>代码示例>>C++>>正文


C++ print_word函数代码示例

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


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

示例1: print_line

static void
print_line(FILE *dest, void *buf, size_t len, size_t addr, char *addr_fmt) {
   size_t words = len / BYTES_PER_WORD;
   size_t last_word = len % BYTES_PER_WORD;
   char *pos = buf;
   size_t i;
   uint32_t line_pos = 0;

   fprintf(dest, addr_fmt, addr);

   for (i = 0; i < words; i++) {
      line_pos += print_word(dest, pos, BYTES_PER_WORD);
      pos += BYTES_PER_WORD;
   }

   if (last_word) {
      line_pos += print_word(dest, pos, last_word);
   }

   fprintf(dest, "%s| ", &spc_line[line_pos]);

   for (i = 0; i < len; i++) {
      char c = ((char*)buf)[i];
      if (isprint(c)) {
         fprintf(dest, "%c", c); 
      } else {
         fprintf(dest, "."); 
      }
   }

   fprintf(dest, "\n");
}
开发者ID:eskaton,项目名称:c-misc,代码行数:32,代码来源:hex_dump.c

示例2: print_production

void print_production (Production* p){
	
     print_word(&p->left);
     printf (" --> ");
     print_word(&p->right);
     print_error(p->error);
}
开发者ID:MastroPocket,项目名称:GrammarReader,代码行数:7,代码来源:funzioni.c

示例3: pre_bl

static int
pre_bl(DECL_ARGS)
{
	size_t		 icol;

	/*
	 * print_offs() will increase the -offset to account for
	 * a possible enclosing .It, but any enclosed .It blocks
	 * just nest and do not add up their indentation.
	 */
	if (n->norm->Bl.offs) {
		print_offs(n->norm->Bl.offs, 0);
		Bl_stack[Bl_stack_len++] = 0;
	}

	switch (n->norm->Bl.type) {
	case LIST_enum:
		n->norm->Bl.count = 0;
		return 1;
	case LIST_column:
		break;
	default:
		return 1;
	}

	if (n->child != NULL) {
		print_line(".TS", MMAN_nl);
		for (icol = 0; icol < n->norm->Bl.ncols; icol++)
			print_word("l");
		print_word(".");
	}
	outflags |= MMAN_nl;
	return 1;
}
开发者ID:drscream,项目名称:illumos-joyent,代码行数:34,代码来源:mdoc_man.c

示例4: post_bd

static void
post_bd(DECL_ARGS)
{
	enum roff_tok	 bef, now;

	/* Close out this display. */
	print_line(".RE", MMAN_nl);
	bef = n->flags & NODE_NOFILL ? ROFF_nf : ROFF_fi;
	if (n->last == NULL)
		now = n->norm->Bd.type == DISP_unfilled ||
		    n->norm->Bd.type == DISP_literal ? ROFF_nf : ROFF_fi;
	else if (n->last->tok == ROFF_nf)
		now = ROFF_nf;
	else if (n->last->tok == ROFF_fi)
		now = ROFF_fi;
	else
		now = n->last->flags & NODE_NOFILL ? ROFF_nf : ROFF_fi;
	if (bef != now) {
		outflags |= MMAN_nl;
		print_word(".");
		outflags &= ~MMAN_spc;
		print_word(roff_name[bef]);
		outflags |= MMAN_nl;
	}

	/* Maybe we are inside an enclosing list? */
	if (NULL != n->parent->next)
		mid_it();
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:29,代码来源:mdoc_man.c

示例5: print_map

void print_map(struct pcp_vars *pcp)
{
   register int *y = y_address;

   int ndgen = pcp->ndgen;
   int dgen = pcp->dgen;
   int p2;
   int i;

#if defined(GROUP)
   printf("\nRelationship between group defining generators and ");
   printf("consistent\npower-commutator presentation generators:\n");
#endif

   for (i = 1; i <= ndgen; i++) {
      p2 = y[dgen + i];
      printf("%d", i);
      printf("  ");
      printf("  =");
      print_word(p2, pcp);
      p2 = y[dgen - i];
      if (p2 <= 0) {
         printf("%d", i);
         printf("^-1 =");
         print_word(p2, pcp);
      }
   }
}
开发者ID:gap-packages,项目名称:anupq,代码行数:28,代码来源:print_presentation.c

示例6: rev_text_1

void rev_text_1(char *text)
{
    char *pos = NULL;
    char *next = NULL;
    struct list *tmp = NULL;
    struct list *rev = NULL;

    pos = text;
    do {
        tmp = calloc(1, sizeof(struct list));
        next = my_strtok(pos, ' ');
        tmp->word = pos;
        tmp->word_len = (unsigned) (next - pos) -1;
        tmp->next = rev;
        rev = tmp;
        pos = next;
    } while( pos != NULL );

    while( rev != '\0' ) {
        print_word( rev->word, 0, rev->word_len);
        tmp = rev;
        rev = rev->next;
        free(tmp);
    }
    print_word("\n", 0, 1);
}
开发者ID:msf,项目名称:configs,代码行数:26,代码来源:rev_words.c

示例7: print_width

/*
 * Set up the indentation for a list item; used from pre_it().
 */
static void
print_width(const struct mdoc_bl *bl, const struct roff_node *child)
{
	char		  buf[24];
	struct roffsu	  su;
	const char	 *end;
	int		  numeric, remain, sz, chsz;

	numeric = 1;
	remain = 0;

	/* Convert the width into a number (of characters). */
	if (bl->width == NULL)
		sz = (bl->type == LIST_hang) ? 6 : 0;
	else {
		end = a2roffsu(bl->width, &su, SCALE_MAX);
		if (end == NULL || *end != '\0')
			sz = man_strlen(bl->width);
		else if (SCALE_EN == su.unit)
			sz = su.scale;
		else {
			sz = 0;
			numeric = 0;
		}
	}

	/* XXX Rough estimation, might have multiple parts. */
	if (bl->type == LIST_enum)
		chsz = (bl->count > 8) + 1;
	else if (child != NULL && child->type == ROFFT_TEXT)
		chsz = man_strlen(child->string);
	else
		chsz = 0;

	/* Maybe we are inside an enclosing list? */
	mid_it();

	/*
	 * Save our own indentation,
	 * such that child lists can use it.
	 */
	Bl_stack[Bl_stack_len++] = sz + 2;

	/* Set up the current list. */
	if (chsz > sz && bl->type != LIST_tag)
		print_block(".HP", 0);
	else {
		print_block(".TP", 0);
		remain = sz + 2;
	}
	if (numeric) {
		(void)snprintf(buf, sizeof(buf), "%dn", sz + 2);
		print_word(buf);
	} else
		print_word(bl->width);
	TPremain = remain;
}
开发者ID:drscream,项目名称:illumos-joyent,代码行数:60,代码来源:mdoc_man.c

示例8: pre_noarg

static void
pre_noarg(DECL_ARGS)
{
	outflags |= MMAN_nl;
	print_word(".");
	outflags &= ~MMAN_spc;
	print_word(roff_name[n->tok]);
	outflags |= MMAN_nl;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:9,代码来源:mdoc_man.c

示例9: do_fontwords

int do_fontwords(int this_font, int other_font, int early_exit)
{
   static char ftab[] = " RBIS";
   char *p=word;
   int i, ch;
   int in_quote = 0;

   no_nl=0;	/* Line is effectivly been reprocessed so NL is visable */
   for(;;)
   {
      if (p == word) {
         strcpy(p, "\\f"); p[2]=ftab[this_font]; p+=3;
      }
      if ((ch=fgetc(ifd)) == EOF || ch == '\n') break;
      if (ch == '"') {
         in_quote = !in_quote;
	 continue;
      }
      if (in_quote || !isspace(ch)) {
	 if (isspace(ch) && p > word+3) {
            strcpy(p, "\\fR"); p+=3; *p=0; print_word(word);
	    p=word;
	    if (no_fill) print_word(" ");
	    continue;
         }
         if (p<word+sizeof(word)-4) *p++ = ch;
	 if (ch == '\\') {
            if ((ch=fgetc(ifd)) == EOF || ch == '\n') break;
            if (p<word+sizeof(word)-4) *p++ = ch;
	 }
	 continue;
      }

      if (p != word+3) {
         if (early_exit) break;

	 if (this_font == other_font)
	 {
            strcpy(p, "\\fR"); p+=3; *p=0; print_word(word);
	    p=word;
	 }
         i=this_font; this_font=other_font; other_font=i;
         if (p<word+sizeof(word)-4) {
            strcpy(p, "\\f"); p[2]=ftab[this_font]; p+=3;
         }
      }
   }
   ungetc(ch, ifd);

   if (p > word+3) {
      strcpy(p, "\\fR"); p+=3;
      *p=0;
      print_word(word);
   }

   return 0;
}
开发者ID:FrancoisGautrais,项目名称:elks,代码行数:57,代码来源:man.c

示例10: post_fn

static void
post_fn(DECL_ARGS)
{

	print_word(")");
	if (NODE_SYNPRETTY & n->flags) {
		print_word(";");
		outflags |= MMAN_PP;
	}
}
开发者ID:drscream,项目名称:illumos-joyent,代码行数:10,代码来源:mdoc_man.c

示例11: pre_ux

static int
pre_ux(DECL_ARGS)
{

	print_word(manacts[n->tok].prefix);
	if (NULL == n->child)
		return(0);
	outflags &= ~MMAN_spc;
	print_word("\\ ");
	outflags &= ~MMAN_spc;
	return(1);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:12,代码来源:mdoc_man.c

示例12: print_pcp_relations

void print_pcp_relations(struct pcp_vars *pcp)
{
   register int *y = y_address;

   register int i;
   register int j;
   register int k;
   register int l;
   register int p1;
   register int p2;
   register int weight;

#include "access.h"

   k = y[pcp->clend + pcp->cc - 1];
/*
  int start, finish;
  printf ("input start, finish: ");
  scanf ("%d %d", &start, &finish);
  */

#if defined(GROUP)
   printf("\nNon-trivial powers:\n");
   /*
     for (i = start; i <= finish; i++) {
     */
   for (i = 1; i <= k; i++) {
      p2 = y[pcp->ppower + i];
      if (p2 != 0) {
         printf(" .%d^%d =", i, pcp->p);
         print_word(p2, pcp);
      }
   }

   printf("\nNon-trivial commutators:\n");
#endif

   /*
     for (i = start; i <= finish; i++) {
     */
   for (i = 2; i <= k; i++) {
      weight = WT(y[pcp->structure + i]);
      p1 = y[pcp->ppcomm + i];
      l = MIN(i - 1, y[pcp->clend + pcp->cc - weight]);
      for (j = 1; j <= l; j++) {
         p2 = y[p1 + j];
         if (p2 != 0) {
            printf("[ .%d, .%d ] =", i, j);
            print_word(p2, pcp);
         }
      }
   }
}
开发者ID:gap-packages,项目名称:anupq,代码行数:53,代码来源:print_presentation.c

示例13: print_width

/*
 * Set up the indentation for a list item; used from pre_it().
 */
static void
print_width(const char *v, const struct mdoc_node *child, size_t defsz)
{
	char		  buf[24];
	struct roffsu	  su;
	size_t		  sz, chsz;
	int		  numeric, remain;

	numeric = 1;
	remain = 0;

	/* Convert v into a number (of characters). */
	if (NULL == v)
		sz = defsz;
	else if (a2roffsu(v, &su, SCALE_MAX)) {
		if (SCALE_EN == su.unit)
			sz = su.scale;
		else {
			sz = 0;
			numeric = 0;
		}
	} else
		sz = strlen(v);

	/* XXX Rough estimation, might have multiple parts. */
	chsz = (NULL != child && MDOC_TEXT == child->type) ?
	    strlen(child->string) : 0;

	/* Maybe we are inside an enclosing list? */
	mid_it();

	/*
	 * Save our own indentation,
	 * such that child lists can use it.
	 */
	Bl_stack[Bl_stack_len++] = sz + 2;

	/* Set up the current list. */
	if (defsz && chsz > sz)
		print_block(".HP", 0);
	else {
		print_block(".TP", 0);
		remain = sz + 2;
	}
	if (numeric) {
		(void)snprintf(buf, sizeof(buf), "%zun", sz + 2);
		print_word(buf);
	} else
		print_word(v);
	TPremain = remain;
}
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:54,代码来源:mdoc_man.c

示例14: pre_onearg

static void
pre_onearg(DECL_ARGS)
{
	outflags |= MMAN_nl;
	print_word(".");
	outflags &= ~MMAN_spc;
	print_word(roff_name[n->tok]);
	if (n->child != NULL)
		print_word(n->child->string);
	outflags |= MMAN_nl;
	if (n->tok == ROFF_ce)
		for (n = n->child->next; n != NULL; n = n->next)
			print_node(meta, n);
}
开发者ID:drscream,项目名称:illumos-joyent,代码行数:14,代码来源:mdoc_man.c

示例15: post_in

static void
post_in(DECL_ARGS)
{

	if (NODE_SYNPRETTY & n->flags) {
		outflags &= ~MMAN_spc;
		print_word(">");
		font_pop();
		outflags |= MMAN_br;
	} else {
		font_pop();
		outflags &= ~MMAN_spc;
		print_word(">");
	}
}
开发者ID:drscream,项目名称:illumos-joyent,代码行数:15,代码来源:mdoc_man.c


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