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

C++ runetochar函数代码示例

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

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



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

示例1: gostringsize

void
runtime·slicerunetostring(Slice b, String s)
{
#line 3599 "C:\Go\src\pkg\runtime\string.goc"

	int32 siz1, siz2, i;
	int32 *a;
	byte dum[8];

	a = (int32*)b.array;
	siz1 = 0;
	for(i=0; i<b.len; i++) {
		siz1 += runtime·runetochar(dum, a[i]);
	}

	s = gostringsize(siz1+4);
	siz2 = 0;
	for(i=0; i<b.len; i++) {
		// check for race
		if(siz2 >= siz1)
			break;
		siz2 += runtime·runetochar(s.str+siz2, a[i]);
	}
	s.len = siz2;
	s.str[s.len] = 0;
	FLUSH(&s);
}
开发者ID:VarocalCross,项目名称:Varocal,代码行数:27,代码来源:zstring_386.c


示例2: FLUSH

void
runtime·slicerunetostring(Slice b, String s)
{
	s.str = 0;
	s.len = 0;
	FLUSH(&s);
#line 309 "/home/14/ren/source/golang/go/src/pkg/runtime/string.goc"

	intgo siz1, siz2, i;
	int32 *a;
	byte dum[8];
	void *pc;

	if(raceenabled) {
		pc = runtime·getcallerpc(&b);
		runtime·racereadrangepc(b.array, b.len*sizeof(*a), pc, runtime·slicerunetostring);
	}
	a = (int32*)b.array;
	siz1 = 0;
	for(i=0; i<b.len; i++) {
		siz1 += runtime·runetochar(dum, a[i]);
	}

	s = gostringsize(siz1+4);
	siz2 = 0;
	for(i=0; i<b.len; i++) {
		// check for race
		if(siz2 >= siz1)
			break;
		siz2 += runtime·runetochar(s.str+siz2, a[i]);
	}
	s.len = siz2;
	s.str[s.len] = 0;
	FLUSH(&s);
}
开发者ID:rosrad,项目名称:go-rep,代码行数:35,代码来源:zstring_linux_arm.c


示例3: gkbdputc

void
gkbdputc(Queue *q, int ch)
{
	int n;
	Rune r;
	static uchar kc[5*UTFmax];
	static int nk, collecting = 0;
	char buf[UTFmax];

	r = ch;
	if(r == Latin) {
		collecting = 1;
		nk = 0;
		return;
	}
	if(collecting) {
		int c;
		nk += runetochar((char*)&kc[nk], &r);
		c = latin1(kc, nk);
		if(c < -1)	/* need more keystrokes */
			return;
		collecting = 0;
		if(c == -1) {	/* invalid sequence */
			qproduce(q, kc, nk);
			return;
		}
		r = (Rune)c;
	}
	n = runetochar(buf, &r);
	if(n == 0)
		return;
	/* if(!isdbgkey(r)) */ 
		qproduce(q, buf, n);
}
开发者ID:Mekapaedia,项目名称:inferno-rpi,代码行数:34,代码来源:devcons.c


示例4: fz_malloc

static char *convert_to_utf8(fz_context *doc, unsigned char *s, int n)
{
	unsigned char *e = s + n;
	char *dst, *d;
	int c;

	if (s[0] == 0xFE && s[1] == 0xFF) {
		dst = d = fz_malloc(doc, n * 2);
		while (s + 1 < e) {
			c = s[0] << 8 | s[1];
			d += runetochar(d, &c);
			s += 2;
		}
		*d = 0;
		return dst;
	}

	if (s[0] == 0xFF && s[1] == 0xFE) {
		dst = d = fz_malloc(doc, n * 2);
		while (s + 1 < e) {
			c = s[0] | s[1] << 8;
			d += runetochar(d, &c);
			s += 2;
		}
		*d = 0;
		return dst;
	}

	return (char*)s;
}
开发者ID:hk0792,项目名称:UsefulClass,代码行数:30,代码来源:xps_xml.c


示例5: pdf_to_utf8

/* Convert Unicode/PdfDocEncoding string into utf-8 */
char *
pdf_to_utf8(fz_obj *src)
{
	unsigned char *srcptr = (unsigned char *) fz_to_str_buf(src);
	char *dstptr, *dst;
	int srclen = fz_to_str_len(src);
	int dstlen = 0;
	int ucs;
	int i;

	if (srclen >= 2 && srcptr[0] == 254 && srcptr[1] == 255)
	{
		for (i = 2; i + 1 < srclen; i += 2)
		{
			ucs = srcptr[i] << 8 | srcptr[i+1];
			dstlen += runelen(ucs);
		}

		dstptr = dst = fz_malloc(dstlen + 1);

		for (i = 2; i + 1 < srclen; i += 2)
		{
			ucs = srcptr[i] << 8 | srcptr[i+1];
			dstptr += runetochar(dstptr, &ucs);
		}
	}
	else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254)
	{
		for (i = 2; i + 1 < srclen; i += 2)
		{
			ucs = srcptr[i] | srcptr[i+1] << 8;
			dstlen += runelen(ucs);
		}

		dstptr = dst = fz_malloc(dstlen + 1);

		for (i = 2; i + 1 < srclen; i += 2)
		{
			ucs = srcptr[i] | srcptr[i+1] << 8;
			dstptr += runetochar(dstptr, &ucs);
		}
	}
	else
	{
		for (i = 0; i < srclen; i++)
			dstlen += runelen(pdf_doc_encoding[srcptr[i]]);

		dstptr = dst = fz_malloc(dstlen + 1);

		for (i = 0; i < srclen; i++)
		{
			ucs = pdf_doc_encoding[srcptr[i]];
			dstptr += runetochar(dstptr, &ucs);
		}
	}

	*dstptr = '\0';
	return dst;
}
开发者ID:jason5001001,项目名称:dataextractor,代码行数:60,代码来源:pdf_parse.c


示例6: pdf_toutf8

fz_error *
pdf_toutf8(char **dstp, fz_obj *src)
{
	unsigned char *srcptr = fz_tostrbuf(src);
	char *dstptr;
	int srclen = fz_tostrlen(src);
	int dstlen = 0;
	int ucs;
	int i;

	if (srclen > 2 && srcptr[0] == 254 && srcptr[1] == 255)
	{
		for (i = 2; i < srclen; i += 2)
		{
			ucs = (srcptr[i] << 8) | srcptr[i+1];
			dstlen += runelen(ucs);
		}

		dstptr = *dstp = fz_malloc(dstlen + 1);
		if (!dstptr)
			return fz_outofmem;

		for (i = 2; i < srclen; i += 2)
		{
			ucs = (srcptr[i] << 8) | srcptr[i+1];
			dstptr += runetochar(dstptr, &ucs);
		}
	}

	else
	{
		for (i = 0; i < srclen; i++)
			dstlen += runelen(pdf_docencoding[srcptr[i]]);

		dstptr = *dstp = fz_malloc(dstlen + 1);
		if (!dstptr)
			return fz_outofmem;

		for (i = 0; i < srclen; i++)
		{
			ucs = pdf_docencoding[srcptr[i]];
			dstptr += runetochar(dstptr, &ucs);
		}
	}

	*dstptr = '\0';
	return nil;
}
开发者ID:wzhsunn,项目名称:SumatraPDF_0.6_Source,代码行数:48,代码来源:pdf_parse.c


示例7: utfrune

char *
utfrune(const char *s, Rune r)
{
	if(r < Runeself) {
		return strchr(s, r);
	}
	else if(r == Runeerror) {
		Rune r0;
		int n;

		for(; *s != '\0'; s += n) {
			n = chartorune(&r0, s);
			if(r == r0)
				return (char *)s;
		}
	}
	else {
		char buf[UTFmax+1];
		int n;

		if(!(n = runetochar(buf, &r)))
			return NULL;
		buf[n] = '\0';
		return strstr(s, buf);
	}
	return NULL;
}
开发者ID:ryanfb,项目名称:ancientgreekocr-grctraining,代码行数:27,代码来源:utf.c


示例8: map

static char *
map(Rune rp[], int font)	/* figure out mapping for char in this font */
{
	static char s[100];
	char c[10];
	Link *p;
	Rune r;

	if(rp[1]==0 &&  rp[0]<QUICK)	/* fast lookup */
		r = charmap[fmap[font]].quick[rp[0]];
	else {	/* high-valued or compound character name */
		sprint(c, "%S", rp);
		r = 0;
		for (p = charmap[fmap[font]].slow; p; p = p->next)
			if(eq(c, p->name)){
				r = p->val;
				break;
			}
	}
	if(r == 0){	/* not there */
		dprint(2, "didn't find %S font# %d\n", rp, font);
		return 0;
	}
	dprint(2, "map %S to %s font# %d\n", rp, s, font);
	s[runetochar(s, &r)] = 0;
	return s;
}
开发者ID:00001,项目名称:plan9port,代码行数:27,代码来源:font.c


示例9: fz_debug_text_span

void
fz_debug_text_span(fz_text_span *span)
{
	char buf[10];
	int c, n, k, i;

	while (span)
	{
		for (i = 0; i < span->len; i++)
		{
			c = span->text[i].c;
			if (c < 128)
				putchar(c);
			else
			{
				n = runetochar(buf, &c);
				for (k = 0; k < n; k++)
					putchar(buf[k]);
			}
		}

		if (span->eol)
			putchar('\n');

		span = span->next;
	}
}
开发者ID:plotnick,项目名称:mupdf,代码行数:27,代码来源:dev_text.c


示例10: smbstringdup

char *
smbstringdup(SmbHeader *h, uchar *base, uchar **bdatap, uchar *edata)
{
	char *p;
	if (h && h->flags2 & SMB_FLAGS2_UNICODE) {
		uchar *bdata = *bdatap;
		uchar *savebdata;
		Rune r;
		int l;
		char *q;

		l = 0;
		if ((bdata - base) & 1)
			bdata++;
		savebdata = bdata;
		do {
			if (bdata + 2 > edata)
				return nil;
			r = smbnhgets(bdata); bdata += 2;
			l += runelen(r);
		} while (r != 0);
		p = smbemalloc(l);
		bdata = savebdata;
		q = p;
		do {
			r = smbnhgets(bdata); bdata += 2;
			q += runetochar(q, &r);
		} while (r != 0);
		*bdatap = bdata;
		return p;
	}
	return smbstrdup(bdatap, edata);
}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:33,代码来源:smbstring.c


示例11: fromlatin1

/*
 *  convert from latin1 to utf
 */
static char*
fromlatin1(char *from)
{
	char *p, *to;
	Rune r;

	if(os == Plan9)
		return nil;

	/* don't convert if we don't have to */
	for(p = from; *p; p++)
		if(*p & 0x80)
			break;
	if(*p == 0)
		return nil;

	to = malloc(3*strlen(from)+2);
	if(to == nil)
		return nil;
	for(p = to; *from; from++){
		r = (*from) & 0xff;
		p += runetochar(p, &r);
	}
	*p = 0;
	return to;
}
开发者ID:99years,项目名称:plan9,代码行数:29,代码来源:proto.c


示例12: exportname

/* From Plan 9 to Unix */
char*
exportname(char* name)
{
	Rune r;
	int   nr;
	char *uxname;
	char *up;

	if (name == 0 || 
		(utfrune(name, altspc) == 0 &&
		 utfrune(name,altlparen) == 0 &&
		 utfrune(name,altrparen) == 0 &&
		 utfrune(name,altamp) == 0 &&
		 utfrune(name,altquote) == 0))
		return name;
	up = uxname = emalloc(strlen(name) + 1);
	names[nnames++] = uxname;
	while(*name != 0){
		nr = chartorune(&r, name);
		if (r == altspc)
			r = ' ';
		if (r == altlparen)
			r = '(';
		if (r == altrparen)
			r = ')';
		if (r == altamp)
			r = '&';
		if (r == altquote)
			r = '\'';
		up += runetochar(up, &r);
		name += nr;
	}
	*up = 0;
	return uxname;
}
开发者ID:CoryXie,项目名称:nix-os,代码行数:36,代码来源:trfs.c


示例13: windocopy

void windocopy(pdfapp_t *app)
{
	unsigned short copyucs2[16 * 1024];
	char *latin1 = copylatin1;
	char *utf8 = copyutf8;
	unsigned short *ucs2;
	int ucs;

	pdfapp_oncopy(&gapp, copyucs2, 16 * 1024);

	for (ucs2 = copyucs2; ucs2[0] != 0; ucs2++)
	{
		ucs = ucs2[0];

		utf8 += runetochar(utf8, &ucs);

		if (ucs < 256)
			*latin1++ = ucs;
		else
			*latin1++ = '?';
	}

	*utf8 = 0;
	*latin1 = 0;

printf("oncopy utf8=%zd latin1=%zd\n", strlen(copyutf8), strlen(copylatin1));

	XSetSelectionOwner(xdpy, XA_PRIMARY, xwin, copytime);

	justcopied = 1;
}
开发者ID:OpenInkpot-archive,项目名称:iplinux-mupdf-fontdump,代码行数:31,代码来源:x11pdf.c


示例14: fz_debug_text_span_xml

void
fz_debug_text_span_xml(fz_text_span *span)
{
	char buf[10];
	int c, n, k, i;

	while (span)
	{
		printf("<span font=\"%s\" size=\"%g\" wmode=\"%d\" eol=\"%d\">\n",
			span->font ? span->font->name : "NULL", span->size, span->wmode, span->eol);

		for (i = 0; i < span->len; i++)
		{
			printf("\t<char ucs=\"");
			c = span->text[i].c;
			if (c < 128)
				putchar(c);
			else
			{
				n = runetochar(buf, &c);
				for (k = 0; k < n; k++)
					putchar(buf[k]);
			}
			printf("\" bbox=\"%d %d %d %d\" />\n",
				span->text[i].bbox.x0,
				span->text[i].bbox.y0,
				span->text[i].bbox.x1,
				span->text[i].bbox.y1);
		}

		printf("</span>\n");

		span = span->next;
	}
}
开发者ID:plotnick,项目名称:mupdf,代码行数:35,代码来源:dev_text.c


示例15: fputrune

int
fputrune(const Rune *r, FILE *fp)
{
	char buf[UTFmax];

	return fwrite(buf, runetochar(buf, r), 1, fp);
}
开发者ID:michaelforney,项目名称:sbase,代码行数:7,代码来源:fputrune.c


示例16: callunix

void
callunix(void)
{
	int c, pid;
	Rune rune;
	char buf[512];
	char *p;

	setnoaddr();
	p = buf;
	while((c=getchr()) != EOF && c != '\n')
		if(p < &buf[sizeof(buf) - 6]) {
			rune = c;
			p += runetochar(p, &rune);
		}
	*p = 0;
	pid = fork();
	if(pid == 0) {
		execlp("rc", "rc", "-c", buf, (char*)0);
		sysfatal("exec failed: %r");
		exits("execl failed");
	}
	waiting = 1;
	while(waitpid() != pid)
		;
	waiting = 0;
	if(vflag)
		putst("!");
}
开发者ID:00001,项目名称:plan9port,代码行数:29,代码来源:ed.c


示例17: kbdputc

/*
 *  Put character, possibly a rune, into read queue at interrupt time.
 *  Called at interrupt time to process a character.
 */
int
kbdputc(Queue *q, int ch)
{
	int i, n;
	char buf[3];
	Rune r;
	char *next;

	if(kbd.ir == nil)
		return 0;		/* in case we're not inited yet */
	
	ilock(&kbd.lockputc);		/* just a mutex */
	r = ch;
	n = runetochar(buf, &r);
	for(i = 0; i < n; i++){
		next = kbd.iw+1;
		if(next >= kbd.ie)
			next = kbd.istage;
		if(next == kbd.ir)
			break;
		*kbd.iw = buf[i];
		kbd.iw = next;
	}
	iunlock(&kbd.lockputc);
	return 0;
}
开发者ID:Requaos,项目名称:harvey,代码行数:30,代码来源:devcons.c


示例18: importname

/* From Unix to Plan 9 */
char*
importname(char* name)
{
	Rune r;
	int  nr;
	char *up;
	char *p9name;

	if (name == 0 ||
	   (strchr(name, ' ') == 0 && strchr(name, '(') == 0 &&
	    strchr(name, ')') == 0 && strchr(name, '&') == 0 &&
	    strchr(name, '\'')== 0))
		return name;
	p9name = emalloc(strlen(name) * 3 + 1);	// worst case: all blanks + 0
	up = p9name;
	names[nnames++] = p9name;
	while (*name != 0){
		nr = chartorune(&r, name);
		if (r == ' ')
			r = altspc;
		if (r == '(')
			r = altlparen;
		if (r == ')')
			r = altrparen;
		if (r == '&')
			r = altamp;
		if (r == '\'')
			r = altquote;
		up += runetochar(up, &r);
		name += nr;
	}
	*up = 0;
	return p9name;
}
开发者ID:CoryXie,项目名称:nix-os,代码行数:35,代码来源:trfs.c


示例19: tosnarf

static int
tosnarf(Win *w, int p0, int p1)
{
	int fd;
	static char buf[512];
	char *c, *ce;
	Rune *rp, *re;
	
	if(p0 >= p1)
		return 0;
	fd = open("/dev/snarf", OWRITE|OTRUNC);
	if(fd < 0){
		cmdprint("tosnarf: %r");
		return -1;
	}
	c = buf;
	ce = buf + sizeof(buf);
	rp = w->runes + p0;
	re = w->runes + p1;
	for(; rp < re; rp++){
		if(c + UTFmax > ce){
			write(fd, buf, c - buf);
			c = buf;
		}
		c += runetochar(c, rp);
	}
	if(c > buf)
		write(fd, buf, c - buf);
	close(fd);
	return 0;
}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:31,代码来源:cmdw.c


示例20: print_ss

void
print_ss(char *s, String *a, String *b)
{
	char *ap, *bp, *cp;
	Rune *rp;

	ap = emalloc(a->n+1);
	for (cp = ap, rp = a->s; *rp; rp++)
		cp += runetochar(cp, rp);
	*cp = 0;
	bp = emalloc(b->n+1);
	for (cp = bp, rp = b->s; *rp; rp++)
		cp += runetochar(cp, rp);
	*cp = 0;
	dprint("?warning: %s `%.*s' and `%.*s'\n", s, a->n, ap, b->n, bp);
	free(ap);
	free(bp);
}
开发者ID:8l,项目名称:sam,代码行数:18,代码来源:unix.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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