这篇教程C++ CHECK_TYPES函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CHECK_TYPES函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_TYPES函数的具体用法?C++ CHECK_TYPES怎么用?C++ CHECK_TYPES使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CHECK_TYPES函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: c_modvoid c_mod() { CHECK_TYPES(sp - 1, T_NUMBER, 1, F_MOD); CHECK_TYPES(sp, T_NUMBER, 2, F_MOD); if ((sp--)->u.number == 0) error("Modulus by zero./n"); sp->u.number %= (sp+1)->u.number;}
开发者ID:xcw0579,项目名称:mudOS,代码行数:7,
示例2: CHECK_TYPESvoid zu::postfix_writer::do_zuidentifier_node(zu::zuidentifier_node * const node, int lvl) { CHECK_TYPES(_compiler, _symtab, node); node->accept(this,lvl); CHECK_TYPES(_compiler, _symtab, node); // simplified generation: all variables are global _pf.ADDR(node->id());}
开发者ID:thefiveleafclover,项目名称:zu-compiler,代码行数:7,
示例3: P3void c_foreach P3(int, flags, int, idx1, int, idx2) { IF_DEBUG(stack_in_use_as_temporary++); if (flags & 4) { CHECK_TYPES(sp, T_MAPPING, 2, F_FOREACH); push_refed_array(mapping_indices(sp->u.map)); (++sp)->type = T_NUMBER; sp->u.lvalue = (sp-1)->u.arr->item; sp->subtype = (sp-1)->u.arr->size; (++sp)->type = T_LVALUE; if (flags & 2) sp->u.lvalue = ¤t_object->variables[idx1 + variable_index_offset]; else sp->u.lvalue = fp + idx1; } else if (sp->type == T_STRING) { (++sp)->type = T_NUMBER; sp->u.lvalue_byte = (unsigned char *)((sp-1)->u.string); sp->subtype = SVALUE_STRLEN(sp - 1); } else { CHECK_TYPES(sp, T_ARRAY, 2, F_FOREACH); (++sp)->type = T_NUMBER; sp->u.lvalue = (sp-1)->u.arr->item; sp->subtype = (sp-1)->u.arr->size; } (++sp)->type = T_LVALUE; if (flags & 1) sp->u.lvalue = ¤t_object->variables[idx2 + variable_index_offset]; else sp->u.lvalue = fp + idx2;}
开发者ID:Junho2009,项目名称:propose_srv_linux,代码行数:35,
示例4: c_foreachvoid c_foreach(int flags, int idx1, int idx2) { IF_DEBUG(stack_in_use_as_temporary++); if (flags & FOREACH_MAPPING) { CHECK_TYPES(sp, T_MAPPING, 2, F_FOREACH); push_refed_array(mapping_indices(sp->u.map)); STACK_INC; sp->type = T_NUMBER; sp->u.lvalue = (sp-1)->u.arr->item; sp->subtype = (sp-1)->u.arr->size; STACK_INC; sp->type = T_LVALUE; if (flags & FOREACH_LEFT_GLOBAL) { sp->u.lvalue = ¤t_object->variables[idx1 + variable_index_offset]; } else { sp->u.lvalue = fp + idx1; } } else if (sp->type == T_STRING) { STACK_INC; sp->type = T_NUMBER; sp->u.lvalue_byte = (unsigned char *)((sp-1)->u.string); sp->subtype = SVALUE_STRLEN(sp - 1); } else { CHECK_TYPES(sp, T_ARRAY, 2, F_FOREACH); STACK_INC; sp->type = T_NUMBER; sp->u.lvalue = (sp-1)->u.arr->item; sp->subtype = (sp-1)->u.arr->size; } if (flags & FOREACH_RIGHT_GLOBAL) { STACK_INC; sp->type = T_LVALUE; sp->u.lvalue = ¤t_object->variables[idx2 + variable_index_offset]; } else if (flags & FOREACH_REF) { ref_t *ref = make_ref(); svalue_t *loc = fp + idx2; /* foreach guarantees our target remains valid */ ref->lvalue = 0; ref->sv.type = T_NUMBER; STACK_INC; sp->type = T_REF; sp->u.ref = ref; DEBUG_CHECK(loc->type != T_NUMBER && loc->type != T_REF, "Somehow a reference in foreach acquired a value before coming into scope"); loc->type = T_REF; loc->u.ref = ref; ref->ref++; } else { STACK_INC; sp->type = T_LVALUE; sp->u.lvalue = fp + idx2; }}
开发者ID:xcw0579,项目名称:mudOS,代码行数:59,
示例5: c_parse_commandvoid c_parse_command(int num_arg) { svalue_t *arg; svalue_t *fp; int i; /* * type checking on first three required parameters to parse_command() */ arg = sp - 2; CHECK_TYPES(&arg[0], T_STRING, 1, F_PARSE_COMMAND); CHECK_TYPES(&arg[1], T_OBJECT | T_ARRAY, 2, F_PARSE_COMMAND); CHECK_TYPES(&arg[2], T_STRING, 3, F_PARSE_COMMAND); /* * allocate stack frame for rvalues and return value (number of matches); * perform some stack manipulation; */ fp = sp; CHECK_STACK_OVERFLOW(num_arg + 1); sp += num_arg + 1; arg = sp; *(arg--) = *(fp--); /* move pattern to top of stack */ *(arg--) = *(fp--); /* move source object or array to just below the pattern */ *(arg) = *(fp); /* move source string just below the object */ fp->type = T_NUMBER; /* * prep area for rvalues */ for (i = 1; i <= num_arg; i++) fp[i].type = T_INVALID; /* * do it... */ i = parse(arg[0].u.string, &arg[1], arg[2].u.string, &fp[1], num_arg); /* * remove mandatory parameters */ pop_3_elems(); /* * save return value on stack */ fp->u.number = i;}
开发者ID:xcw0579,项目名称:mudOS,代码行数:48,
示例6: CHECK_TYPESvoid pwn::postfix_writer::do_simple_lvalue_node(pwn::simple_lvalue_node * const node, int lvl) { CHECK_TYPES(_compiler, _symtab, node); std::string id = fix_id(node->value()); std::shared_ptr<pwn::symbol> symbol = _symtab.find(id); if ( ! _current_function) { // global context if ( ! symbol->is_var()) { throw "Error: assigning a value to a function"; } _pf.ADDR(id); } else { // local context bool is_return_symbol = ( ! symbol->is_var()) // the symbol is a function && (_current_function->name() == symbol->name()) // the symbol has the same name as the current function && ( ! is_void(_current_function->type())); // the function doesnt "return" void if (is_return_symbol) { if (is_double(_current_function->type())) { _pf.LOCAL(-8); // double @ -8 } else { _pf.LOCAL(-4); // int, string, pointer @ -4 } } else if (symbol->is_var() && symbol->name() != _current_function->name()) { _pf.LOCAL(symbol->offset()); } else { throw "Error: invalid left value"; } }}
开发者ID:Buton3l,项目名称:pwn-compiler,代码行数:33,
示例7: CHECK_TYPESvoid zu::postfix_writer::do_var_declaration_node(zu::var_declaration_node * const node, int lvl){ CHECK_TYPES(_compiler, _symtab, node); std::string identifier = *(node->identifier()->identifier()); std::shared_ptr<zu::symbol> symbol = _symtab.find(identifier); if(node->ext()){ _pf.EXTERN(identifier); }else if(!_am_I_in_function){ if(node->visibility()){ _pf.GLOBAL(identifier, _pf.OBJ()); symbol->is_global(true); } _pf.BSS(); _pf.ALIGN(); _pf.LABEL(identifier); _pf.BYTE(node->type()->size()); _pf.TEXT(); _pf.ALIGN(); }else{ if(_is_arg){ symbol->offset(_arg_offset); _arg_offset += symbol->type()->size(); symbol->is_global(false); }else { symbol->offset(-_max_offset); _max_offset -= symbol->type()->size(); symbol->is_global(false); } } }
开发者ID:francisco-polaco,项目名称:compilers-2016-ist,代码行数:34,
示例8: CHECK_TYPESvoid zu::postfix_writer::do_div_node(cdk::div_node * const node, int lvl) { //debug(node, lvl); CHECK_TYPES(_compiler, _symtab, node); node->left()->accept(this, lvl+2); node->right()->accept(this, lvl+2); _pf.DIV();}
开发者ID:Portulinas,项目名称:istKillMe,代码行数:7,
示例9: CHECK_TYPESvoid zu::xml_writer::do_println_node(zu::println_node * const node, int lvl) { // FIXME CHECK_TYPES(_compiler, _symtab, node); openTag(node, lvl); node->argument()->accept(this, lvl + 2); closeTag(node, lvl);}
开发者ID:francisco-polaco,项目名称:compilers-2016-ist,代码行数:7,
示例10: CHECK_TYPESvoid pwn::postfix_writer::do_neg_node(cdk::neg_node * const node, int lvl) { CHECK_TYPES(_compiler, _symtab, node); node->argument()->accept(this, lvl); // determine the value if (node->type()->name() == basic_type::TYPE_DOUBLE) _pf.DNEG(); if (node->type()->name() == basic_type::TYPE_INT) _pf.NEG(); // 2-complement}
开发者ID:josenogueira,项目名称:COMP1415-pwnCompiler,代码行数:8,
注:本文中的CHECK_TYPES函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CHECK_UNITID函数代码示例 C++ CHECK_TYPEDEF函数代码示例 |