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

C++ pfmt函数代码示例

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

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



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

示例1: require_token

void parser_t::dippins()
{
    pstring_list_t pins;

    pins.add(get_identifier());
    require_token(m_tok_comma);

    while (true)
    {
        pstring t1 = get_identifier();
        pins.add(t1);
        token_t n = get_token();
        if (n.is(m_tok_param_right))
            break;
        if (!n.is(m_tok_comma))
            error(pfmt("expected a comma, found <{1}>")(n.str()) );
    }
    if ((pins.size() % 2) == 1)
        error("You must pass an equal number of pins to DIPPINS");
    unsigned n = pins.size();
    for (unsigned i = 0; i < n / 2; i++)
    {
        m_setup.register_alias(pfmt("{1}")(i+1), pins[i*2]);
        m_setup.register_alias(pfmt("{1}")(n-i), pins[i*2 + 1]);
    }
}
开发者ID:JensGrabner,项目名称:mame,代码行数:26,代码来源:nl_parser.c


示例2: addenv

void
addenv(var *v)
{
	char envname[Maxenvname];
	word *w;
	int f;
	io *fd;
	if(v->changed){
		v->changed = 0;
		snprint(envname, sizeof envname, "/env/%s", v->name);
		if((f = Creat(envname))<0)
			pfmt(err, "rc: can't open %s: %r\n", envname);
		else{
			for(w = v->val;w;w = w->next)
				write(f, w->word, strlen(w->word)+1L);
			close(f);
		}
	}
	if(v->fnchanged){
		v->fnchanged = 0;
		snprint(envname, sizeof envname, "/env/fn#%s", v->name);
		if((f = Creat(envname))<0)
			pfmt(err, "rc: can't open %s: %r\n", envname);
		else{
			if(v->fn){
				fd = openfd(f);
				pfmt(fd, "fn %q %s\n", v->name, v->fn[v->pc-1].s);
				closeio(fd);
			}
			close(f);
		}
	}
}
开发者ID:aahud,项目名称:harvey,代码行数:33,代码来源:plan9.c


示例3: panic

void
panic(char *s, int n)
{
	pfmt(err, "rc: ");
	pfmt(err, s, n);
	pchr(err, '\n');
	flush(err);
	Abort();
}
开发者ID:99years,项目名称:plan9,代码行数:9,代码来源:subr.c


示例4: Xsimple

void
Xsimple(void)
{
	word *a;
	thread *p = runq;
	var *v;
	struct builtin *bp;
	int pid;
	globlist();
	a = runq->argv->words;
	if(a==0){
		Xerror1("empty argument list");
		return;
	}
	if(flag['x'])
		pfmt(err, "%v\n", p->argv->words); /* wrong, should do redirs */
	v = gvlook(a->word);
	if(v->fn)
		execfunc(v);
	else{
		if(strcmp(a->word, "builtin")==0){
			if(count(a)==1){
				pfmt(err, "builtin: empty argument list\n");
				setstatus("empty arg list");
				poplist();
				return;
			}
			a = a->next;
			popword();
		}
		for(bp = Builtin;bp->name;bp++)
			if(strcmp(a->word, bp->name)==0){
				(*bp->fnc)();
				return;
			}
		if(exitnext()){
			/* fork and wait is redundant */
			pushword("exec");
			execexec();
			Xexit();
		}
		else{
			flush(err);
			Updenv();	/* necessary so changes don't go out again */
			if((pid = execforkexec()) < 0){
				Xerror("try again");
				return;
			}

			/* interrupts don't get us out */
			poplist();
			while(Waitfor(pid, 1) < 0)
				;
		}
	}
}
开发者ID:chrislusf,项目名称:push,代码行数:56,代码来源:simple.c


示例5: bcheck2

static void bcheck2(int n, int c1, int c2)
{
	if (n == 1)
		pfmt(stderr, MM_ERROR, ":21:Missing %c\n", c2);
	else if (n > 1)
		pfmt(stderr, MM_ERROR, ":22:%d missing %c's\n", n, c2);
	else if (n == -1)
		pfmt(stderr, MM_ERROR, ":23:Extra %c\n", c2);
	else if (n < -1)
		pfmt(stderr, MM_ERROR, ":24:%d extra %c's\n", -n, c2);
}
开发者ID:Sunshine-OS,项目名称:svr4-userland,代码行数:11,代码来源:lib.c


示例6: Xerror1

void
Xerror1(char *s)
{
	if(strcmp(argv0, "rc")==0 || strcmp(argv0, "/bin/rc")==0)
		pfmt(err, "rc: %s\n", s);
	else
		pfmt(err, "rc (%s): %s\n", argv0, s);
	flush(err);
	setstatus("error");
	while(!runq->iflag) Xreturn();
}
开发者ID:kisom,项目名称:site-tools,代码行数:11,代码来源:exec.c


示例7: get_token

double ptokenizer::get_number_double()
{
	token_t tok = get_token();
	if (!tok.is_type(NUMBER))
	{
		error(pfmt("Expected a number, got <{1}>")(tok.str()) );
	}
	bool err = false;
	double ret = tok.str().as_double(&err);
	if (err)
		error(pfmt("Expected a number, got <{1}>")(tok.str()) );
	return ret;
}
开发者ID:bmunger,项目名称:mame,代码行数:13,代码来源:pparser.cpp


示例8: get_token

// FIXME: combine into template
double ptokenizer::get_number_double()
{
	token_t tok = get_token();
	if (!tok.is_type(NUMBER))
	{
		error(pfmt("Expected a number, got <{1}>")(tok.str()) );
	}
	bool err;
	double ret = plib::pstonum_ne<double>(tok.str(), err);
	if (err)
		error(pfmt("Expected a number, got <{1}>")(tok.str()) );
	return ret;
}
开发者ID:PugsyMAME,项目名称:mame,代码行数:14,代码来源:pparser.cpp


示例9: execnewpgrp

void
execnewpgrp(void)
{
	int arg;
	char *s;
	switch(count(runq->argv->words)){
	case 1:
		arg = RFENVG|RFNAMEG|RFNOTEG;
		break;
	case 2:
		arg = 0;
		for(s = runq->argv->words->next->word;*s;s++) switch(*s){
		default:
			goto Usage;
		case 'n':
			arg|=RFNAMEG;  break;
		case 'N':
			arg|=RFCNAMEG;
			break;
		case 'm':
			arg|=RFNOMNT;  break;
		case 'e':
			arg|=RFENVG;   break;
		case 'E':
			arg|=RFCENVG;  break;
		case 's':
			arg|=RFNOTEG;  break;
		case 'f':
			arg|=RFFDG;    break;
		case 'F':
			arg|=RFCFDG;   break;
		}
		break;
	default:
	Usage:
		pfmt(err, "Usage: %s [fnesFNEm]\n", runq->argv->words->word);
		setstatus("rfork usage");
		poplist();
		return;
	}
	if(rfork(arg)==-1){
		pfmt(err, "rc: %s failed\n", runq->argv->words->word);
		setstatus("rfork failed");
	}
	else
		setstatus("");
	poplist();
}
开发者ID:aahud,项目名称:harvey,代码行数:48,代码来源:plan9.c


示例10: Xwrite

void
Xwrite(void)
{
	char *file;
	int f;
	switch(count(runq->argv->words)){
	default:
		Xerror1("> requires singleton\n");
		return;
	case 0:
		Xerror1("> requires file\n");
		return;
	case 1:
		break;
	}
	file = runq->argv->words->word;
	if((f = Creat(file))<0){
		pfmt(err, "%s: ", file);
		Xerror("can't open");
		return;
	}
	pushredir(ROPEN, f, runq->code[runq->pc].i);
	runq->pc++;
	poplist();
}
开发者ID:kisom,项目名称:site-tools,代码行数:25,代码来源:exec.c


示例11: execshift

void
execshift(void)
{
	int n;
	word *a;
	var *star;
	switch(count(runq->argv->words)){
	default:
		pfmt(err, "Usage: shift [n]\n");
		setstatus("shift usage");
		poplist();
		return;
	case 2:
		n = atoi(runq->argv->words->next->word);
		break;
	case 1:
		n = 1;
		break;
	}
	star = vlook("*");
	for(;n && star->val;--n){
		a = star->val->next;
		efree(star->val->word);
		efree((char *)star->val);
		star->val = a;
		star->changed = 1;
	}
	setstatus("");
	poplist();
}
开发者ID:chrislusf,项目名称:push,代码行数:30,代码来源:simple.c


示例12: yyerror

void
yyerror(char *s)
{
	extern unsigned char /**cmdname,*/ *curfname;
	static int been_here = 0;

	if (been_here++ > 2)
		return;
	pfmt(stderr, (MM_ERROR | MM_NOGET), "%s", s);
	pfmt(stderr, MM_NOSTD, atline, lineno);
	if (curfname != NULL)
		pfmt(stderr, MM_NOSTD, infunc, curfname);
	fprintf(stderr, "\n");
	errorflag = 2;
	eprint();
}
开发者ID:Sunshine-OS,项目名称:svr4-userland,代码行数:16,代码来源:lib.c


示例13: Abort

void
Abort(void)
{
	pfmt(err, "aborting\n");
	flush(err);
	Exit("aborting");
}
开发者ID:aahud,项目名称:harvey,代码行数:7,代码来源:plan9.c


示例14: efree

void
efree(void *p)
{
/*	pfmt(err, "free %p\n", p); flush(err); /**/
	if(p)
		free(p);
	else pfmt(err, "free 0\n");
}
开发者ID:99years,项目名称:plan9,代码行数:8,代码来源:subr.c


示例15: execcd

void
execcd(void)
{
	word *a = runq->argv->words;
	word *cdpath;
	char dir[512];
	setstatus("can't cd");
	cdpath = vlook("cdpath")->val;
	switch(count(a)){
	default:
		pfmt(err, "Usage: cd [directory]\n");
		break;
	case 2:
		if(a->next->word[0]=='/' || cdpath==0)
			cdpath=&nullpath;
		for(;cdpath;cdpath = cdpath->next){
			strcpy(dir, cdpath->word);
			if(dir[0])
				strcat(dir, "/");
			strcat(dir, a->next->word);
			if(dochdir(dir)>=0){
				if(strlen(cdpath->word)
				&& strcmp(cdpath->word, ".")!=0)
					pfmt(err, "%s\n", dir);
				setstatus("");
				break;
			}
		}
		if(cdpath==0)
			pfmt(err, "Can't cd %s: %r\n", a->next->word);
		break;
	case 1:
		a = vlook("home")->val;
		if(count(a)>=1){
			if(dochdir(a->word)>=0)
				setstatus("");
			else
				pfmt(err, "Can't cd %s: %r\n", a->word);
		}
		else
			pfmt(err, "Can't cd -- $home empty\n");
		break;
	}
	poplist();
}
开发者ID:chrislusf,项目名称:push,代码行数:45,代码来源:simple.c


示例16: pquo

void
pquo(Io *f, char *s)
{
	pchr(f, '\'');
	for(;*s;s++)
		if(*s=='\'') pfmt(f, "''");
		else pchr(f, *s);
	pchr(f, '\'');
}
开发者ID:JamesLinus,项目名称:inferno,代码行数:9,代码来源:io.c


示例17: eprint

static void eprint(void)	/* try to print context around error */
{
	unsigned char *p, *q, *r;
	int c, episnul;
	static int been_here = 0;
	extern unsigned char ebuf[300], *ep;

	if (compile_time == 2 || compile_time == 0 || been_here++ > 0)
		return;
	episnul = ep > ebuf && ep[-1] == '\0';
	p = ep - 1 - episnul;
	if (p > ebuf && *p == '\n')
		p--;
	for ( ; p > ebuf && *p != '\n' && *p != '\0'; p--)
		;
	while (*p == '\n')
		p++;
	if (0 /* posix */)
		pfmt(stderr, MM_INFO, ":28:Context is\n\t");
	else
		pfmt(stderr, MM_INFO|MM_NOSTD, ":2228: context is\n\t");
	for (q=ep-1-episnul; q>=p && *q!=' ' && *q!='\t' && *q!='\n'; q--)
		;
	for (r = q; r < ep; r++) {
		if (*r != ' ' && *r != '\t' && *r != '\n') {
			for ( ; p < q; p++)
				if (*p)
					putc(*p, stderr);
			break;
		}
	}
	fprintf(stderr, " >>> ");
	for ( ; p < ep; p++)
		if (*p)
			putc(*p, stderr);
	fprintf(stderr, " <<< ");
	if (*ep)
		while ((c = awk_input()) != '\n' && c != '\0' && c != EOF) {
			putc(c, stderr);
			bclass(c);
		}
	putc('\n', stderr);
	ep = ebuf;
}
开发者ID:Sunshine-OS,项目名称:svr4-userland,代码行数:44,代码来源:lib.c


示例18: vyyerror

void
vyyerror(const char *msg, ...)
{
	extern unsigned char *curfname;
	va_list args;

	if (been_here++ > 2)
		return;
	va_start(args, msg);
	vpfmt(stderr, MM_ERROR, msg, args);
	pfmt(stderr, MM_NOSTD, atline, lineno);
	if (curfname != NULL)
		pfmt(stderr, MM_NOSTD, infunc, curfname);
	fprintf(stderr, "\n");
	errorflag = 2;
	eprint();

	va_end(args);
}
开发者ID:Sunshine-OS,项目名称:svr4-userland,代码行数:19,代码来源:lib.c


示例19: pfnc

void
pfnc(io *fd, thread *t)
{
	int i;
	void (*fn)(void) = t->code[t->pc].f;
	list *a;

	pfmt(fd, "pid %d cycle %p %d ", getpid(), t->code, t->pc);
	for (i = 0; fname[i].f; i++) 
		if (fname[i].f == fn) {
			pstr(fd, fname[i].name);
			break;
		}
	if (!fname[i].f)
		pfmt(fd, "%p", fn);
	for (a = t->argv; a; a = a->next) 
		pfmt(fd, " (%v)", a->words);
	pchr(fd, '\n');
	flush(fd);
}
开发者ID:aahud,项目名称:harvey,代码行数:20,代码来源:pfnc.c


示例20: execexit

void
execexit(void)
{
	switch(count(runq->argv->words)){
	default:
		pfmt(err, "Usage: exit [status]\nExiting anyway\n");
	case 2:
		setstatus(runq->argv->words->next->word);
	case 1:	Xexit();
	}
}
开发者ID:chrislusf,项目名称:push,代码行数:11,代码来源:simple.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pfn_pte函数代码示例发布时间:2022-05-30
下一篇:
C++ pfind函数代码示例发布时间: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