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

C++ consume函数代码示例

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

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



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

示例1: consume_loop

void *
consume_loop(void *vptr)
{
	int		i, val;

	printf("consume_loop thread, addr(stack) = %x\n", &i);
	for (i = 0; i < NLOOP; i++) {
		val = consume(&buf_t);
	}

	return(NULL);
}
开发者ID:tcharding,项目名称:self_learning,代码行数:12,代码来源:example03.c


示例2: NEW

/* [<id> [, <formals>]] */
static Formals *formals() {
  Formals *p = 0;

  if (isId()) {
    p = NEW(Formals);
    p->first = getId();
    consume();
    p->n = 1;
    p->rest = 0;

    if (isComma()) {
      consume();
      p->rest = formals();
      if (p->rest) {
        p->n = p->rest->n + 1;
      }
    }
  }

  return p;
}
开发者ID:souvik1997,项目名称:fun2llvm,代码行数:22,代码来源:parser.c


示例3: compile_document

/*
 * top-level compilation; break the document into
 * style, html, and source blocks with footnote links
 * weeded out.
 */
static Paragraph *
compile_document(Line *ptr, MMIOT *f)
{
    ParagraphRoot d = { 0, 0 };
    ANCHOR(Line) source = { 0, 0 };
    Paragraph *p = 0;
    struct kw *tag;
    int eaten, unclosed;

    while ( ptr ) {
	if ( !(f->flags & MKD_NOHTML) && (tag = isopentag(ptr)) ) {
	    /* If we encounter a html/style block, compile and save all
	     * of the cached source BEFORE processing the html/style.
	     */
	    if ( T(source) ) {
		E(source)->next = 0;
		p = Pp(&d, 0, SOURCE);
		p->down = compile(T(source), 1, f);
		T(source) = E(source) = 0;
	    }
	    p = Pp(&d, ptr, strcmp(tag->id, "STYLE") == 0 ? STYLE : HTML);
	    ptr = htmlblock(p, tag, &unclosed);
	    if ( unclosed ) {
		p->typ = SOURCE;
		p->down = compile(p->text, 1, f);
		p->text = 0;
	    }
	}
	else if ( isfootnote(ptr) ) {
	    /* footnotes, like cats, sleep anywhere; pull them
	     * out of the input stream and file them away for
	     * later processing
	     */
	    ptr = consume(addfootnote(ptr, f), &eaten);
	}
	else {
	    /* source; cache it up to wait for eof or the
	     * next html/style block
	     */
	    ATTACH(source,ptr);
	    ptr = ptr->next;
	}
    }
    if ( T(source) ) {
	/* if there's any cached source at EOF, compile
	 * it now.
	 */
	E(source)->next = 0;
	p = Pp(&d, 0, SOURCE);
	p->down = compile(T(source), 1, f);
    }
    return T(d);
}
开发者ID:13983441921,项目名称:OCPDFGen,代码行数:58,代码来源:markdown.c


示例4: main

int main(int argc, char ** argv)
{
    unsigned char * payload = malloc(PAYLOAD_LEN);

    unsigned char tag = server(payload);

    // Now consume the tag and the payload.
    // This is not part of the model and in fact would violate secrecy if observable.
    consume(tag, payload);

    return 0;
}
开发者ID:tari3x,项目名称:csec-modex,代码行数:12,代码来源:server.c


示例5: FNTRACE

std::unique_ptr<Expr> FlowParser::interpolatedStr()
{
	FNTRACE();

	FlowLocation sloc(location());
	std::unique_ptr<Expr> result = std::make_unique<StringExpr>(stringValue(), sloc.update(end()));
	nextToken(); // interpolation start

	std::unique_ptr<Expr> e(expr());
	if (!e)
		return nullptr;

    result = asString(std::move(result));
    if (!result) {
        reportError("Cast error in string interpolation.");
        return nullptr;
    }

	while (token() == FlowToken::InterpolatedStringFragment) {
		FlowLocation tloc = sloc.update(end());
		result = std::make_unique<BinaryExpr>(
            Opcode::SADD,
			std::move(result),
			std::make_unique<StringExpr>(stringValue(), tloc)
		);
		nextToken();

		e = expr();
		if (!e)
			return nullptr;

        e = asString(std::move(e));
        if (!e) {
            reportError("Cast error in string interpolation.");
            return nullptr;
        }

		result = std::make_unique<BinaryExpr>(Opcode::SADD, std::move(result), std::move(e));
	}

	if (!consume(FlowToken::InterpolatedStringEnd))
		return nullptr;

	if (!stringValue().empty()) {
		result = std::make_unique<BinaryExpr>(
            Opcode::SADD,
			std::move(result),
			std::make_unique<StringExpr>(stringValue(), sloc.update(end()))
		);
	}
	nextToken();
	return result;
}
开发者ID:hiwang123,项目名称:x0,代码行数:53,代码来源:FlowParser.cpp


示例6: D

void D()
{
 //printf("\nEnter <D>");
 if(!strcmp(token,"CONSTANT"))
 consume();

 if(!(strcmp(token,"FLT_TYP") && strcmp(token,"BOOL_TYP") && strcmp(token,"INT_TYP") && strcmp(token,"STR_TYP")))
 {
 consume();

 V();

 if(!strcmp(token,"STMNT_END"))
 consume();
 else
 {
 //error("Unterminated Declaration statement. Expecting ;");
 }
 }
 //printf("\nExit <D>");
}
开发者ID:chardHacks,项目名称:MOEpl,代码行数:21,代码来源:SyntacticAnalyzer.CPP


示例7: main

int main (int argc, char **argv)
{
    printf("pong started.\n");

    unsigned int i;
    for (i = 0; i < 20; i++) {
      if (i % 2 == 0)
        consume();
    }

    return 0;
}
开发者ID:shengnwen,项目名称:Yale-OperatingSystems,代码行数:12,代码来源:pong.c


示例8: consume

Generator::ParenthesesType Parser::consumeParenthesesType()
{
    if (peek() != '?')
        return Generator::Capturing;
    consume();

    switch (consume()) {
    case ':':
        return Generator::NonCapturing;
    
    case '=':
        return Generator::Assertion;

    case '!':
        return Generator::InvertedAssertion;

    default:
        setError(ParenthesesTypeInvalid);
        return Generator::Error;
    }
}
开发者ID:DreamOnTheGo,项目名称:src,代码行数:21,代码来源:WRECParser.cpp


示例9: consume

void Parser::forStat() {
    consume(TK_for);
    syms->enterBlock(false);    
    CERR(TOKEN != TK_NAME, E_FOR_NAME, VNIL);

    Value name = lexer->info.name;
    int slot = syms->localsTop();
    advance();
    consume(':'+TK_EQUAL);
    patchOrEmitMove(slot+2, slot+2, expr(slot+2));
    consume(':');
    patchOrEmitMove(slot+3, slot+1, expr(slot+3));
    int pos1 = emitHole();
    int pos2 = HERE;
    syms->set(name, slot);
    syms->addLocalsTop(2);
    insideBlock();
    emitJump(HERE, LOOP, VAL_REG(slot), pos2);
    emitJump(pos1, FOR,  VAL_REG(slot), HERE);
    syms->exitBlock(false);
}
开发者ID:preda,项目名称:pepper,代码行数:21,代码来源:Parser.cpp


示例10: consumer_loop

void consumer_loop(void *arg)
{
    int rc = 0;
    event_buffer_t *buffer = (event_buffer_t *)arg;
    while (rc == 0 && exit_signal == 0)
    {
        rc = consume(buffer);
    }

    if (rc != 0)
        printf("consumer problem\n");
}
开发者ID:j42lin,项目名称:code-samples,代码行数:12,代码来源:producer_consumer.c


示例11: dt

void dt()
{
 //printf("\nEnter <dt>");
 if(!strcmp(token,"ID"))
 {
 consume();
 dt1();
 }
 else
 error("Declaration syntax error. Expecting IDENTIFIER or TERMINATOR");
 //printf("\nExit <dt>");
}
开发者ID:chardHacks,项目名称:MOEpl,代码行数:12,代码来源:SyntacticAnalyzer.CPP


示例12: parse

 boost::tuple<boost::tribool, InputIterator> parse(request& req,
     InputIterator begin, InputIterator end)
 {
   while (begin != end)
   {
     boost::tribool result = consume(req, *begin++);
     if (result || !result)
       return boost::make_tuple(result, begin);
   }
   boost::tribool result = boost::indeterminate;
   return boost::make_tuple(result, begin);
 }
开发者ID:BigR-Lab,项目名称:CodeRes_Cpp,代码行数:12,代码来源:request_parser.hpp


示例13: HexagonGOT

//===----------------------------------------------------------------------===//
// HexagonGOTPLT
//===----------------------------------------------------------------------===//
HexagonGOTPLT::HexagonGOTPLT(LDSection& pSection)
  : HexagonGOT(pSection)
{
  // Create GOT0 entries
  reserve(HexagonGOTPLT0Num);

  // Skip GOT0 entries
  for (size_t i = 0; i < HexagonGOTPLT0Num; ++i) {
    consume();
  }
  pSection.setAlign(8);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_frameworks_compile_mclinker,代码行数:15,代码来源:HexagonGOTPLT.cpp


示例14: forkSmokers

void forkSmokers()
{
	printf("FORKING THREE SMOKERS!\n\n");
	pid_t S1 = fork();
	if (S1 == 0) {
		//forked properly
		printf("SMOKER S1:%d\n", getpid());
		smoke();
		fflush(stdout);
		exit(0);
	} else if (S1 < 0) {
		perror("Failed to fork");
	} else {
		wait();
		consume();

		pid_t S2 = fork();
		if (S2 == 0) {
			printf("SMOKER S2:%d\n", getpid());
			smoke();
			fflush(stdout);
			exit(0);
		} else if (S2 < 0) {
			perror("Failed to fork");
		} else {
			wait();
			consume();

			pid_t S3 = fork();
			if (S3 == 0) {
				printf("SMOKER S3:%d\n", getpid());
				smoke();
				fflush(stdout);
				exit(0);
			} else if (S3 < 0) {
				perror("Failed to fork");
			}
		}
	}
}
开发者ID:chas11man,项目名称:eecs338-assignment1,代码行数:40,代码来源:AGENT.c


示例15: consume

// Fill a direct offer.
//   @param offer the offer we are going to use.
//   @param amount the amount to flow through the offer.
//   @returns: tesSUCCESS if successful, or an error code otherwise.
TER
Taker::fill (Offer const& offer, Amounts const& amount)
{
    consume (offer, amount);

    // Pay the taker, then the owner
    TER result = view ().accountSend (offer.account(), account(), amount.out);

    if (result == tesSUCCESS)
        result = view ().accountSend (account(), offer.account(), amount.in);

    return result;
}
开发者ID:Joke-Dk,项目名称:rippled,代码行数:17,代码来源:Taker27.cpp


示例16: match

/**Make sure current lookahead symbol matches token type <tt>t</tt>.
 * Throw an exception upon mismatch, which is catch by either the
 * error handler or by the syntactic predicate.
 */
void Parser::match(int t)
{
    if ( DEBUG_PARSER )
        std::cout << "enter match(" << t << ") with LA(1)=" << LA(1) << std::endl;
    if ( LA(1)!=t ) {
        if ( DEBUG_PARSER )
            std::cout << "token mismatch: " << LA(1) << "!=" << t << std::endl;
        throw MismatchedTokenException(tokenNames, LT(1), t, false);
    } else {
        // mark token as consumed -- fetch next token deferred until LA/LT
        consume();
    }
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:17,代码来源:Parser.cpp


示例17: resynch

void ANTLRParser::
resynch(SetWordType *wd,SetWordType mask)
{

/* MR8              [email protected]                          */
/* MR8              Change file scope static "consumed" to instance var */

	/* if you enter here without having consumed a token from last resynch
	 * force a token consumption.
	 */
/* MR8 */  	if ( !resynchConsumed ) {consume(); resynchConsumed=1; return;}

   	/* if current token is in resynch set, we've got what we wanted */

/* MR8 */  	if ( wd[LA(1)]&mask || LA(1) == eofToken ) {resynchConsumed=0; return;}
	
   	/* scan until we find something in the resynch set */

        	while ( !(wd[LA(1)]&mask) && LA(1) != eofToken ) {consume();}

/* MR8 */	resynchConsumed=1;
}
开发者ID:Kohrara,项目名称:edk,代码行数:22,代码来源:AParser.cpp


示例18: _rangeCharset

 RegNodePtr _rangeCharset()
 {
     if (tryConsume('[')) {
         auto p = new RegNode_Charset();
         RegNodePtr r(p);
         bool isInv = tryConsume('^');
         _rangeCharSeq(p);
         if (isInv) p->inverse();
         consume(']');
         return r;
     }
     return RegNodePtr();
 }
开发者ID:GHScan,项目名称:DailyProjects,代码行数:13,代码来源:RegParser.cpp


示例19: StringBuffer

void DocumentBuilder::consumeComment(Node *root){
  StringBuffer *sb = null;
  if (root != null && !isIgnoringComments()){
    sb = new StringBuffer();
  }
  consume("<!--", 4);
  while(peek(0) != '-' || peek(1) != '-' || peek(2) != '>'){
    if (peek(0) == -1){
      delete sb;
      get();
    }
    if (root && !isIgnoringComments()){
      sb->append(get());
    }else{
      get();
    }
  }
  consume("-->", 3);
  if (root != null && !isIgnoringComments()){
    root->appendChild(doc->createComment(sb));
  }
}
开发者ID:OutOfOrder,项目名称:mod_highlight,代码行数:22,代码来源:xmldom.cpp


示例20: consume

 void Parser::match(Token::ID i) {
     if (i == curTok().Type) {
         consume();
     } else {
         SourceLoc begin = curTok().Begin;
         SourceLoc end = curTok().getEnd();
         ParseError err(begin,ParseError::match_fail);
         err <<  Token::getHumanTokenName(i) << 
                 Token::getHumanTokenName(lookahead(0).Type);
         err.setEnd(end);
         throw err;
     }
 }
开发者ID:trishume,项目名称:OpenTuringParser,代码行数:13,代码来源:Parser.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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