您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unget函数代码示例

51自学网 2021-06-03 09:09:36
  C++
这篇教程C++ unget函数代码示例写得很实用,希望能帮到您。

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

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

示例1: gotop

voidgotop(int c){	char optmp[OPLENGTH];	char *op_ptr;	struct op *s_op;	char *a, *b;	op_ptr = optmp;	*op_ptr++ = c;	while (isop((uchar)( *op_ptr = getch())))op_ptr++;	if(!strict)unget(*op_ptr);	else if (*op_ptr != ' ')unget( *op_ptr);	*op_ptr = '/0';	s_op = op;	b = optmp;	while ((a = s_op->name) != 0){		op_ptr = b;		while ((*op_ptr == *a) && (*op_ptr != '/0')){			a++;			op_ptr++;		}		if (*a == '/0'){			keep(s_op);			opflag = s_op->setop;			if (*op_ptr != '/0'){				b = op_ptr;				s_op = op;				continue;			}			else break;		}		else s_op++;	}}
开发者ID:00001,项目名称:plan9port,代码行数:34,


示例2: charmap

char CharMapper::trigraph(){	if (settings.trigraph) {		char c = charmap();		if (c == '?') {			c = charmap();			if (c == '?') {				c = charmap();				switch (c) {				case '=': return '#';				case '/': return '//';				case '(': return '[';				case ')': return ']';				case '/'': return '^';				case '!': return '|';				case '<': return '{';				case '>': return '}';				case '-': return '~';				}				unget(c);				unget('?');			} else {				unget(c);			}			return '?';		} else {			return c;		}	} else {		return in.get();	}}
开发者ID:bqqbarbhg,项目名称:dcc,代码行数:32,


示例3: _fact

static int _fact(void * bp, int get(void * bp), int unget(int c, void * bp)){	signed c;	int n = 1;	while ((c = get(bp)) != EOF)	{		if (isblank(c)) continue;		else if(isdigit(c))		{			unget (c, bp);			n *= _numb(bp, get, unget);		}		else if(c == '(')		{			n *= _numb(bp, get, unget);			if ((c = get(bp)) != ')') unget(c, bp);		}		else 		{			unget (c, bp);			break;		}	}	return (n);}
开发者ID:razzlefratz,项目名称:MotleyTools,代码行数:26,


示例4: get

std::string Parser::readString(){    do {        char c = get();        if (isspace(c)) {            continue;        } else if (c == '#') {            forgetLine();            continue;        } else {            unget();            break;        }    } while (mStream);    if (not mStream) {        throw utils::InternalError();    } else {        std::string result;        do {            char c = get();            if (isalnum(c)) {                result += c;            } else {                unget();                return result;            }        } while (mStream);        return result;    }}
开发者ID:SJasson,项目名称:vle,代码行数:35,


示例5: getimpsym

Sym*getimpsym(void){	int c;	char *cp;	c = getnsc();	if(isspace(c) || c == '"') {		unget(c);		return S;	}	for(cp = symb;;) {		if(cp <= symb+NSYMB-4)			*cp++ = c;		c = getc();		if(c > 0 && !isspace(c) && c != '"')			continue;		unget(c);		break;	}	*cp = 0;	if(cp > symb+NSYMB-4)		yyerror("symbol too large: %s", symb);	return lookup();}
开发者ID:Ahmah2009,项目名称:golang,代码行数:25,


示例6: parseExport

  Error parseExport() {    COFFShortExport E;    E.Name = Tok.Value;    read();    if (Tok.K == Equal) {      read();      if (Tok.K != Identifier)        return createError("identifier expected, but got " + Tok.Value);      E.ExtName = E.Name;      E.Name = Tok.Value;    } else {      unget();    }    if (Machine == IMAGE_FILE_MACHINE_I386) {      if (!isDecorated(E.Name, MingwDef))        E.Name = (std::string("_").append(E.Name));      if (!E.ExtName.empty() && !isDecorated(E.ExtName, MingwDef))        E.ExtName = (std::string("_").append(E.ExtName));    }    for (;;) {      read();      if (Tok.K == Identifier && Tok.Value[0] == '@') {        Tok.Value.drop_front().getAsInteger(10, E.Ordinal);        read();        if (Tok.K == KwNoname) {          E.Noname = true;        } else {          unget();        }        continue;      }      if (Tok.K == KwData) {        E.Data = true;        continue;      }      if (Tok.K == KwConstant) {        E.Constant = true;        continue;      }      if (Tok.K == KwPrivate) {        E.Private = true;        continue;      }      unget();      Info.Exports.push_back(E);      return Error::success();    }  }
开发者ID:dongjinxian,项目名称:llvm,代码行数:50,


示例7: gottype

voidgottype(struct keyw *lptr){	char *pt;	struct keyw *tlptr;	int c;	while(1){		pt = getnext(1);		if((tlptr=lookup(pt,lastplace+1))!=0){			putch(' ',YES);			copy(tlptr->name);			*pt='/0';			lastplace = pt;			if(tlptr->type == STRUCT){				putch(tlptr->punc,YES);				gotstruct();				break;			}			lptr=tlptr;			continue;		}		else{			putch(lptr->punc,NO);			while((c=getch())== ' ' || c == '/t');			unget(c);			break;		}	}}
开发者ID:00001,项目名称:plan9port,代码行数:29,


示例8: bootstrap

void bootstrap( void ){	for( ;; ) {		get();		switch( *sp ) {		case '#':			drop();			skip_to_nl();			break;				case ':':			drop();			get_name();			make_def();			compile_to_def();			bootcompile();			fixate_colon_def();			break;					default:			unget();			compile_to_buffer();			bootcompile();			bootinterpreter();			break;		}	}		 }  
开发者ID:noqsi,项目名称:LSE-ARM,代码行数:28,


示例9: atoi

int CredReader::ReadNumber(){	int num = atoi(&data[dataindex]);	while(isdigit(get())) ;	unget();	return num;}
开发者ID:EXL,项目名称:NXEngine,代码行数:7,


示例10: getRaw

//// SourceTokenizerC::doCommand//void SourceTokenizerC::doCommand(){   SourceTokenC::Reference tok = getRaw(); doAssert(tok, SourceTokenC::TT_NAM);        if (tok->data == "define")  doCommand_define(tok);   else if (tok->data == "else")    doCommand_else(tok);   else if (tok->data == "elif")    doCommand_elif(tok);   else if (tok->data == "endif")   doCommand_endif(tok);   else if (tok->data == "error")   doCommand_error(tok);   else if (tok->data == "if")      doCommand_if(tok);   else if (tok->data == "ifdef")   doCommand_ifdef(tok);   else if (tok->data == "ifndef")  doCommand_ifndef(tok);   else if (tok->data == "include") doCommand_include(tok);   else if (tok->data == "undef")   doCommand_undef(tok);   else if (tok->data == "warning") doCommand_warning(tok);   else if(isSkip())   {      while(tok->type != SourceTokenC::TT_ENDL)         tok = getRaw();      unget(tok);   }   else Error(tok->pos, "unknown command: %s", tok->data.c_str());}
开发者ID:DavidPH,项目名称:DH-acc,代码行数:28,


示例11: esc_char

static int esc_char(int in_char_literal){	int c = get();	int v, i;	switch (c)	{	case 'b':		return '/b';	case 'e':		return 033;	case 'f':		return '/f';	case 'n':		return '/n';	case 't':		return '/t';	default:		if (c >= '0' && c <= '7')		{			for(v = i = 0; i < 3 && c >= '0' && c <= '7'; c = get())				v = v*8 + c-'0';			unget();			return v;		}		return c;	}}
开发者ID:SemiSQ,项目名称:OpenModelica,代码行数:28,


示例12: get_codepar_token

/* * Read the rest of a line that starts `/c'. Including nothing at * all (tok_word with empty text). */token get_codepar_token(input * in){  int c;  token ret;  rdstring rs = { 0, 0, NULL };  filepos cpos;  ret.type = tok_word;  c = get(in, &cpos);           /* expect (and discard) one space */  ret.pos = cpos;  if (c == ' ')  {    c = get(in, &cpos);    ret.pos = cpos;  }  while (!isnl(c) && c != EOF)  {    int c2 = c;    c = get(in, &cpos);    /* Discard /r just before /n. */    if (c2 != 13 || !isnl(c))      rdadd(&rs, (wchar_t)c2);  }  unget(in, c, &cpos);  ret.text = ustrdup(rs.text);  sfree(rs.text);  return ret;}
开发者ID:151706061,项目名称:nsis-chinese,代码行数:32,


示例13: unget

//---------------------------------------------------------------------------bool SPARQLLexer::hasNext(Token value)   // Peek at the next token{   Token peek=getNext();   unget(peek);   return peek==value;}
开发者ID:anukat2015,项目名称:AdHash,代码行数:8,


示例14: isbrace

/* * Determine whether the next input character is an open brace (for * telling code paragraphs from paragraphs which merely start with * code). */int isbrace(input * in){  int c;  filepos cpos;  c = get(in, &cpos);  unget(in, c, &cpos);  return (c == '{');}
开发者ID:151706061,项目名称:nsis-chinese,代码行数:14,


示例15: doif

FILE_LOCALvoid doif(int hash)/* * Process an #if, #ifdef, or #ifndef.  The latter two are straightforward, * while #if needs a subroutine of its own to evaluate the expression. * * doif() is called only if compiling is TRUE.  If false, compilation * is always supressed, so we don't need to evaluate anything.  This * supresses unnecessary warnings. */{        register int            c;        register int            found;        if ((c = skipws()) == '/n' || c == EOF_CHAR) {            unget();            goto badif;        }        if (hash == L_if) {            unget();            found = (eval() != 0);      /* Evaluate expr, != 0 is  TRUE */            hash = L_ifdef;             /* #if is now like #ifdef       */        }        else {            if (type[c] != LET)         /* Next non-blank isn't letter  */                goto badif;             /* ... is an error              */            found = (lookid(c) != NULL); /* Look for it in symbol table */        }        if (found == (hash == L_ifdef)) {            compiling = TRUE;            *ifptr |= TRUE_SEEN;        }        else {            compiling = FALSE;        }        return;badif:  cerror("#if, #ifdef, or #ifndef without an argument", NULLST);#if !OLD_PREPROCESSOR        skipnl();                               /* Prevent an extra     */        unget();                                /* Error message        */#endif        return;}
开发者ID:cjapes,项目名称:core,代码行数:44,


示例16: unget

Lizt_old_ATTLC&Lizt_old_ATTLC::unget(const Lizt_old_ATTLC& ll){	if (ll.sz) {	    register lnk_old_ATTLC*    aLink = ll.t;	    do unget(aLink->copy());	    while ((aLink = aLink->prv) != ll.t);	}	return *this;}
开发者ID:seyko2,项目名称:cfront-3,代码行数:10,


示例17: skipSpaces

 int skipSpaces() {     int c = get();     while (c != EOF && ::isspace(c))     {         c = get();     }     unget();     return c; }
开发者ID:adroitly,项目名称:boom,代码行数:10,


示例18: nextword

	void nextword(std::string& rv)	{		int ch = next();		while (isspace(ch))			ch = next();		while (isalnum(ch) || ch == '_'|| ch == '-')		{			rv.push_back(ch);			ch = next();		}		unget(ch);	}
开发者ID:KeiroD,项目名称:inspircd,代码行数:12,


示例19: parseName

 // NAME outputPath [BASE=address] Error parseName(std::string *Out, uint64_t *Baseaddr) {   read();   if (Tok.K == Identifier) {     *Out = Tok.Value;   } else {     *Out = "";     unget();     return Error::success();   }   read();   if (Tok.K == KwBase) {     if (Error Err = expect(Equal, "'=' expected"))       return Err;     if (Error Err = readAsInt(Baseaddr))       return Err;   } else {     unget();     *Baseaddr = 0;   }   return Error::success(); }
开发者ID:dongjinxian,项目名称:llvm,代码行数:22,


示例20: getnl

intgetnl(void){	int ch;	char *savp;	int gotcmt;	gotcmt = 0;	savp = p;	while ((ch = getch()) == '/t' || ch == ' ')putch(ch,NO);	if (ch == '/'){		if ((ch = getch()) == '*'){			putch('/',NO);			putch('*',NO);			comment(NO);			ch = getch();			gotcmt=1;		}		else if (ch == '/') {			putch('/',NO);			putch('/',NO);			cpp_comment(NO);			ch = getch();			gotcmt = 1;		}		else {			if(inswitch)*(++lastplace) = ch;			else {				inswitch = 1;				*lastplace = ch;			}			unget('/');			return(0);		}	}	if(ch == '/n'){		if(gotcmt == 0)p=savp;		return(1);	}	unget(ch);	return(0);}
开发者ID:00001,项目名称:plan9port,代码行数:40,


示例21: parseNumbers

 // HEAPSIZE/STACKSIZE reserve[,commit] Error parseNumbers(uint64_t *Reserve, uint64_t *Commit) {   if (Error Err = readAsInt(Reserve))     return Err;   read();   if (Tok.K != Comma) {     unget();     Commit = nullptr;     return Error::success();   }   if (Error Err = readAsInt(Commit))     return Err;   return Error::success(); }
开发者ID:dongjinxian,项目名称:llvm,代码行数:14,


示例22: while

Parser::Token Parser::nextToken(){    while (mStream) {        char c = get();        if (not mStream) {            return Parser::Error;        } else if (isspace(c)) {            continue;        } else if (c == '#') {            forgetLine();            continue;        } else if (std::isdigit(c)) {            unget();            return Parser::Real;        } else if (c == '+') {            unget();            return Parser::RelativeReal;        } else if (c == '"') {            unget();            return Parser::QuoteStr;        } else if (c == '{') {            unget();            return Parser::Begin;        } else if (c == '}') {            unget();            return Parser::End;        } else if (c == '=') {            unget();            return Parser::Equal;        } else if (c == ',') {            unget();            return Parser::Comma;        } else if (c == ';') {            unget();            return Parser::Semicolon;        } else {            unget();            return Parser::Str;        }    }    return Parser::Error;}
开发者ID:SJasson,项目名称:vle,代码行数:44,


示例23: doif

/* * Process an #if, #ifdef, or #ifndef.  The latter two are straightforward, * while #if needs a subroutine of its own to evaluate the expression. * * doif() is called only if compiling is TRUE.  If false, compilation * is always suppressed, so we don't need to evaluate anything.  This * suppresses unnecessary warnings. */FILE_LOCAL void doif(int hash){    int c;    int found;    if ((c = skipws()) == '/n' || c == EOF_CHAR)    {        unget();        goto badif;    }    if (hash == L_if)    {        unget();        found = (eval() != 0);      /* Evaluate expr, != 0 is  TRUE */        hash = L_ifdef;             /* #if is now like #ifdef       */    }    else    {        if (type[c] != LET)         /* Next non-blank isn't letter  */            goto badif;             /* ... is an error              */        found = (lookid(c) != NULL); /* Look for it in symbol table */    }    if (found == (hash == L_ifdef))    {        compiling = TRUE;        *ifptr |= TRUE_SEEN;    }    else    {        compiling = FALSE;    }    return;  badif:  cerror("#if, #ifdef, or #ifndef without an argument", NULLST);    skipnl();                               /* Prevent an extra     */    unget();                                /* Error message        */    return;}
开发者ID:zzz99977,项目名称:core,代码行数:46,


示例24: _numb

static int _numb(void * bp, int get(void * bp), int unget(int c, void * bp)){	int c = get(bp);	int n = 0;	while (isdigit(c))	{		n *= 10;		n += (c - '0');		c = get(bp);	}	unget (c, bp);	return (n);}
开发者ID:razzlefratz,项目名称:MotleyTools,代码行数:14,


示例25: eval

a_uinteval(){	int c, v;	a_uint n;	c = getnb();	n = 0;	while ((v = digit(c, radix)) >= 0) {		n = n*radix + v;		c = get();	}	unget(c);	return((n & s_mask) ? n | ~v_mask : n & v_mask);}
开发者ID:malbanGit,项目名称:Vide,代码行数:15,


示例26: gotstruct

voidgotstruct(void){	int c;	int cc;	char *pt;	while((c=getch()) == ' ' || c == '/t')		if(!strict)putch(c,NO);	if(c == '{'){		structlev++;		unget(c);		return;	}	if(isalpha(c)){		putch(c,NO);		while(isalnum(c=getch()))putch(c,NO);	}	unget(c);	pt = getnext(1);	if(*pt == '{')structlev++;	if(strict){		eatallsp();		putch(' ',NO);	}}
开发者ID:00001,项目名称:plan9port,代码行数:24,


示例27: admode

/* * Enter admode() to search a specific addressing mode table * for a match. Return the addressing value on a match or * -1 for no match. */intadmode(struct adsym *sp){        char *ptr;        int i;        unget(getnb());        i = 0;        while ( *(ptr = &sp[i].a_str[0]) ) {                if (srch(ptr)) {                        return(sp[i].a_val);                }                i++;        }        return(-1);}
开发者ID:Derpybunneh,项目名称:cpctelera,代码行数:21,


示例28: skip_space

void skip_space( void ){	for(;;){		get();		if( !flag ) { drop(); return; }		if( !isspace( *sp )) {			unget();			flag = 1;			return;		}		if( *sp++ == '/n' ) {			flag = 0;			return;		}	}}
开发者ID:noqsi,项目名称:LSE-ARM,代码行数:16,


示例29: get_token

void get_token( void ){	int n;		skip_space();	if( !flag ) return;		for( n = 0;; n += 1) {		get();		if( !flag ) break;		if( isspace( *sp ) ) break;		constop[ D_DATA + 1 + n ] = *sp++;	}	constop[ D_DATA ] = n;	if( flag ) unget(); else drop();	flag = 1;}
开发者ID:noqsi,项目名称:LSE-ARM,代码行数:17,



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


C++ ungetc函数代码示例
C++ unexec_error函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。