bool StBndBox::isIn(const StGLVec3& thePnt) const { if(isVoid()) { return false; } return thePnt.x() <= myMax.x() && thePnt.x() >= myMin.x() && thePnt.y() <= myMax.y() && thePnt.y() >= myMin.y() && thePnt.z() <= myMax.z() && thePnt.z() >= myMin.z(); }
TypeStructure::Kind TypeAnnotation::getKind() const { if (isVoid()) { return TypeStructure::Kind::T_void; } // Primitive types if (isPrimType("HH\\int")) { return TypeStructure::Kind::T_int; } if (isPrimType("HH\\bool")) { return TypeStructure::Kind::T_bool; } if (isPrimType("HH\\float")) { return TypeStructure::Kind::T_float; } if (isPrimType("HH\\string")) { return TypeStructure::Kind::T_string; } if (isPrimType("HH\\resource")) { return TypeStructure::Kind::T_resource; } if (isPrimType("HH\\num")) { return TypeStructure::Kind::T_num; } if (isPrimType("HH\\arraykey")) { return TypeStructure::Kind::T_arraykey; } if (isPrimType("HH\\noreturn")) { return TypeStructure::Kind::T_noreturn; } if (isMixed()) { return TypeStructure::Kind::T_mixed; } if (m_tuple) { return TypeStructure::Kind::T_tuple; } if (m_function) { return TypeStructure::Kind::T_fun; } if (!strcasecmp(m_name.c_str(), "array")) { return (m_shape) ? TypeStructure::Kind::T_shape : TypeStructure::Kind::T_array; } if (m_typevar) { return TypeStructure::Kind::T_typevar; } if (m_typeaccess) { return TypeStructure::Kind::T_typeaccess; } if (m_xhp) { // TODO(7657500): in the runtime, resolve this type to a class. return TypeStructure::Kind::T_xhp; } return TypeStructure::Kind::T_unresolved; }
bool AsmJsType::isSubType(AsmJsType type) const { switch (type.which_) { case Js::AsmJsType::Double: return isDouble(); break; case Js::AsmJsType::MaybeDouble: return isMaybeDouble(); break; case Js::AsmJsType::DoubleLit: return isDoubleLit(); break; case Js::AsmJsType::Float: return isFloat(); break; case Js::AsmJsType::MaybeFloat: return isMaybeFloat(); break; case Js::AsmJsType::Floatish: return isFloatish(); break; case Js::AsmJsType::FloatishDoubleLit: return isFloatishDoubleLit(); break; case Js::AsmJsType::Fixnum: return which_ == Fixnum; break; case Js::AsmJsType::Int: return isInt(); break; case Js::AsmJsType::Signed: return isSigned(); break; case Js::AsmJsType::Unsigned: return isUnsigned(); break; case Js::AsmJsType::Intish: return isIntish(); break; case Js::AsmJsType::Void: return isVoid(); break; case AsmJsType::Int32x4: return isSIMDInt32x4(); break; case AsmJsType::Float32x4: return isSIMDFloat32x4(); break; case AsmJsType::Float64x2: return isSIMDFloat64x2(); break; default: break; } return false; }
bool RtValue::toBool2()const{ if(isObject()){ return value.value_obj->toBool(); }else if(isVoid() || isUndefined()){ return false; }else{ return true; } }
// @mfunc Constructor. OMWeakObjectReference::OMWeakObjectReference(void) : OMObjectReference(), _identification(0), _identificationSize(0), _targetTag(nullOMPropertyTag), _targetSet(0) { TRACE("OMWeakObjectReference::OMWeakObjectReference"); POSTCONDITION("void", isVoid()); }
void ParamList::unmarshallSDAGCall(XStr &str, int isFirst) { if (isFirst && isMessage()) str<<"("<<param->type<<")impl_msg"; else if (!isVoid()) { str << "genClosure->"; str << param->getName(); if (next) { str<<", "; next->unmarshallSDAGCall(str, 0); } } }
void StBndBox::enlarge(const StGLVec3& theNewPnt) { if(isVoid()) { // setup the first point myMin = theNewPnt; myMax = theNewPnt; StBndContainer::setDefined(); } else { myMin = getMinValues(myMin, theNewPnt); myMax = getMaxValues(myMax, theNewPnt); } }
void checkBinOp(char const *op, symbol_t const *s1, symbol_t const *s2) { if(isVoid(&s1->type) || isVoid(&s2->type)) { yyerror("Les opérandes ne peuvent pas être de type void."); } else if(op == EQU || op == INF) { checkIndirectionLevel(s1, s2); } else if(op == SOU) { if(s1->type.indirectionCount != s2->type.indirectionCount && s2->type.indirectionCount > 0) { yyerror("Opérandes invalide pour l'opérateur de soustraction"); } } else if(op == ADD) { checkScalar(s2); } else if(op == MUL || op == DIV) { checkScalar(s1); checkScalar(s2); } }
void ParamList::unmarshall(XStr &str, int isFirst) //Pass-by-value { if (isFirst && isMessage()) str<<"("<<param->type<<")impl_msg"; else if (!isVoid()) { str<<param->getName(); if (next) { str<<", "; next->unmarshall(str, 0); } } }
//---------------------------------------------------------------------- // основная выводилка команд void idaapi C39_out(void) { char buf[MAXSTR]; #if IDP_INTERFACE_VERSION > 37 init_output_buffer(buf, sizeof(buf)); // setup the output pointer #else u_line = buf; #endif // выведем мнемонику OutMnem(); // выведем первый операнд if(cmd.Op1.type!=o_void)out_one_operand(0); // выведем второй операнд if(cmd.Op2.type != o_void){ out_symbol(','); OutChar(' '); out_one_operand(1); // выведем третий операнд if(cmd.Op3.type != o_void){ out_symbol(','); OutChar(' '); out_one_operand(2); } } // выведем непосредственные данные, если они есть if ( isVoid(cmd.ea,uFlag,0) ) OutImmChar(cmd.Op1); if ( isVoid(cmd.ea,uFlag,1) ) OutImmChar(cmd.Op2); if ( isVoid(cmd.ea,uFlag,2) ) OutImmChar(cmd.Op3); // завершим строку #if IDP_INTERFACE_VERSION > 37 term_output_buffer(); #else *u_line = '\0'; #endif gl_comm = 1; MakeLine(buf); }
Array<var>* var::convertToArray() { if (auto* array = getArray()) return array; Array<var> tempVar; if (! isVoid()) tempVar.add (*this); *this = tempVar; return getArray(); }
void ParamList::unmarshallAddress(XStr &str, int isFirst) //Pass-by-reference, for Fortran { if (isFirst && isMessage()) str<<"("<<param->type<<")impl_msg"; else if (!isVoid()) { if (param->isArray()) str<<param->getName(); //Arrays are already pointers else str<<"& "<<param->getName(); //Take address of simple types and structs if (next) { str<<", "; next->unmarshallAddress(str, 0); } } }
LCPP_TestCase(Syntax_BuiltinFunctions, define) { auto pResult = LCPP_pNil; pResult = evalString("(define x 1)"); CUT_ASSERT.isTrue(isVoid(pResult)); pResult = evalString("x"); CUT_ASSERT.isTrue(number::getInteger(pResult) == 1); }
void handle_assign(ast* lv, ast* expr) { if (isVoid(lv)) return; if ((isReal(lv) && !isReal(expr) && !isInt(expr)) || (!isReal(lv) && strcmp(lv->type, expr->type) != 0)) { char msg[60]; strcpy(msg, "cannot assign "); strcat(msg, expr->type); strcat(msg, " to "); strcat(msg, lv->type); error(msg, lv); } }
//---------------------------------------------------------------------- void idaapi out(void) { char buf[MAXSTR]; init_output_buffer(buf, sizeof(buf)); OutMnem(); out_one_operand(0); if ( cmd.Op2.type != o_void ) { out_symbol(','); OutChar(' '); out_one_operand(1); } if ( isVoid(cmd.ea, uFlag, 0) ) OutImmChar(cmd.Op1); if ( isVoid(cmd.ea, uFlag, 1) ) OutImmChar(cmd.Op2); term_output_buffer(); gl_comm = 1; MakeLine(buf); }
void out(void) { char buf[MAXSTR]; init_output_buffer(buf, sizeof(buf)); // setup the output pointer OutMnem(); // output instruction mnemonics out_one_operand(0); // output the first operand if ( cmd.Op2.type != o_void) { out_symbol(','); OutChar(' '); out_one_operand(1); // output the second operand } if ( cmd.Op3.type != o_void) { out_symbol(','); OutChar(' '); out_one_operand(2); // output the third operand } // output a character representation of the immediate values // embedded in the instruction as comments if ( isVoid(cmd.ea,uFlag,0) ) OutImmChar(cmd.Op1); if ( isVoid(cmd.ea,uFlag,1) ) OutImmChar(cmd.Op2); if ( isVoid(cmd.ea,uFlag,2) ) OutImmChar(cmd.Op3); term_output_buffer(); // terminate the output string gl_comm = 1; // ask to attach a possible user- // defined comment to it MakeLine(buf); // pass the generated line to the // kernel }
void StBndBox::enlarge(const StArray<StGLVec3>& thePoints) { if(thePoints.size() == 0) { return; } if(isVoid()) { // setup the first point myMin = thePoints.getFirst(); myMax = thePoints.getFirst(); StBndContainer::setDefined(); } for(size_t aPntId = 1; aPntId < thePoints.size(); ++aPntId) { const StGLVec3& aPnt = thePoints[aPntId]; myMin = getMinValues(myMin, aPnt); myMax = getMaxValues(myMax, aPnt); } }
LCPP_TestCase(Syntax_BuiltinFunctions, set) { CUT_ASSERT.throwsNothing([]{ evalString("set!"); }); CUT_ASSERT.throws<exceptions::NoBindingFound>([]{ evalString("(set! x 1)"); }); auto pResult = LCPP_pNil; evalString("(define x 1)"); pResult = evalString("x"); CUT_ASSERT.isTrue(number::getInteger(pResult) == 1); pResult = evalString("(set! x 42)"); CUT_ASSERT.isTrue(isVoid(pResult)); pResult = evalString("x"); CUT_ASSERT.isTrue(number::getInteger(pResult) == 42); }
Array<var>* var::convertToArray() { Array<var>* array = getArray(); if (array == nullptr) { const Array<var> tempVar; var v (tempVar); array = v.value.arrayValue; if (! isVoid()) array->add (*this); swapWith (v); } return array; }
/******************* C/C++ Parameter Marshalling ****************** For entry methods like: entry void foo(int nx,double xarr[nx],complex<float> yarr[ny],long ny); We generate code on the call-side (in the proxy entry method) to create a message and copy the user's parameters into it. Scalar fields are PUP'd, arrays are just memcpy'd. The message looks like this: messagestart>--------- PUP'd data ---------------- | PUP'd nx | PUP'd offset-to-xarr (from array start, int byte count) | PUP'd length-of-xarr (in elements) | PUP'd offset-to-yarr | PUP'd length-of-yarr (in elements) | PUP'd ny +------------------------------------------- | alignment gap (to multiple of 16 bytes) arraystart>------- xarr data ---------- | xarr[0] | xarr[1] | ... | xarr[nx-1] +------------------------------ | alignment gap (for yarr-elements) +--------- yarr data ---------- | yarr[0] | yarr[1] | ... | yarr[ny-1] +------------------------------ On the recieve side, all the scalar fields are PUP'd to fresh stack copies, and the arrays are passed to the user as pointers into the message data-- so there's no copy on the receive side. The message is freed after the user entry returns. */ Parameter::Parameter(int Nline,Type *Ntype,const char *Nname, const char *NarrLen,Value *Nvalue) : type(Ntype) , name(Nname) , arrLen(NarrLen) , val(Nvalue) , line(Nline) , byConst(false) , conditional(0) , given_name(Nname) , podType(false) { if (isMessage()) { name="impl_msg"; } if (name==NULL && !isVoid()) {/*Fabricate a unique name for this marshalled param.*/ static int unnamedCount=0; name=new char[50]; sprintf((char *)name,"impl_noname_%x",unnamedCount++); } byReference=false; declaredReference = false; if ((arrLen==NULL)&&(val==NULL)) { /* Consider passing type by reference: */ if (type->isNamed()) { /* Some user-defined type: pass by reference */ byReference=true; } if (type->isReference()) { byReference=true; declaredReference = true; /* Clip off the ampersand--we'll add it back ourselves in Parameter::print. */ type=type->deref(); } if (type->isConst()) { byConst = true; type = type->deref(); } } }
/** marshalling: pack fields into flat byte buffer **/ void ParamList::marshall(XStr &str, XStr &entry) { if (isVoid()) str<<" void *impl_msg = CkAllocSysMsg();\n"; else if (isMarshalled()) { str<<" //Marshall: ";print(str,0);str<<"\n"; //First pass: find sizes str<<" int impl_off=0;\n"; int hasArrays=orEach(&Parameter::isArray); if (hasArrays) { str<<" int impl_arrstart=0;\n"; callEach(&Parameter::marshallArraySizes,str); } str<<" { //Find the size of the PUP'd data\n"; str<<" PUP::sizer implP;\n"; callEach(&Parameter::pup,str); if (hasArrays) { /*round up pup'd data length--that's the first array*/ str<<" impl_arrstart=CK_ALIGN(implP.size(),16);\n"; str<<" impl_off+=impl_arrstart;\n"; } else /*No arrays--no padding*/ str<<" impl_off+=implP.size();\n"; str<<" }\n"; //Now that we know the size, allocate the packing buffer if (hasConditional()) str<<" MarshallMsg_"<<entry<<" *impl_msg=CkAllocateMarshallMsgT<MarshallMsg_"<<entry<<" >(impl_off,impl_e_opts);\n"; else str<<" CkMarshallMsg *impl_msg=CkAllocateMarshallMsg(impl_off,impl_e_opts);\n"; //Second pass: write the data str<<" { //Copy over the PUP'd data\n"; str<<" PUP::toMem implP((void *)impl_msg->msgBuf);\n"; callEach(&Parameter::pup,str); callEach(&Parameter::copyPtr,str); str<<" }\n"; if (hasArrays) { //Marshall each array str<<" char *impl_buf=impl_msg->msgBuf+impl_arrstart;\n"; callEach(&Parameter::marshallArrayData,str); } } }
LCPP_TestCase(Syntax_BuiltinFunctions, begin) { auto pResult = LCPP_pNil; ////////////////////////////////////////////////////////////////////////// pResult = evalString("begin"); CUT_ASSERT.isTrue(syntax::builtin::getName(pResult) == symbol::create("begin")); ////////////////////////////////////////////////////////////////////////// pResult = evalString("(begin)"); CUT_ASSERT.isTrue(isVoid(pResult)); ////////////////////////////////////////////////////////////////////////// pResult = evalString("(begin 1)"); CUT_ASSERT.isTrue(number::getInteger(pResult) == 1); ////////////////////////////////////////////////////////////////////////// pResult = evalString("(begin 1 2)"); CUT_ASSERT.isTrue(number::getInteger(pResult) == 2); }
int ParamList::isMarshalled(void) const { return !isVoid() && !isMessage(); }
bool Type::isObject() const { return !isFunction() && !isReference() && !isVoid(); }
bool Type::isFundamental() const { return isArithmetic() || isVoid(); }
static int typsLen(type *p){ int i= 0; while( !isVoid(*p) ) ++p,++i; return i; }
//---------------------------------------------------------------------- void idaapi out(void) { char buf[MAXSTR]; init_output_buffer(buf, sizeof(buf)); OutMnem(); out_one_operand(0); if ( cmd.Op2.type != o_void ) { out_symbol(','); OutChar(' '); out_one_operand(1); if ( cmd.IsParallel ) { // new line for Parallel instructions term_output_buffer(); MakeLine(buf); init_output_buffer(buf, sizeof(buf)); out_line("|| ", COLOR_INSN); const char *insn2 = NULL; switch ( cmd.itype ) { case TMS320C54_ld_mac: insn2 = "mac "; break; case TMS320C54_ld_macr: insn2 = "macr "; break; case TMS320C54_ld_mas: insn2 = "mas "; break; case TMS320C54_ld_masr: insn2 = "masr "; break; case TMS320C54_st_add: insn2 = "add "; break; case TMS320C54_st_sub: insn2 = "sub "; break; case TMS320C54_st_ld: insn2 = "ld "; break; case TMS320C54_st_mpy: insn2 = "mpy "; break; case TMS320C54_st_mac: insn2 = "mac "; break; case TMS320C54_st_macr: insn2 = "macr "; break; case TMS320C54_st_mas: insn2 = "mas "; break; case TMS320C54_st_masr: insn2 = "masr "; break; default: warning("interr: out parallel instruction"); } out_line(insn2, COLOR_INSN); } if ( cmd.Op3.type != o_void ) { if ( !cmd.IsParallel ) { out_symbol(','); OutChar(' '); } out_one_operand(2); if ( cmd.Op4_type != 0 ) { out_symbol(','); OutChar(' '); switch ( cmd.Op4_type ) { case o_reg: out_register(ph.regNames[cmd.Op4_value]); break; case o_cond8: out_cond8(cmd.Op4_value); break; default: break; } } } } if ( isVoid(cmd.ea, uFlag, 0) ) OutImmChar(cmd.Op1); if ( isVoid(cmd.ea, uFlag, 1) ) OutImmChar(cmd.Op2); if ( isVoid(cmd.ea, uFlag, 2) ) OutImmChar(cmd.Op3); term_output_buffer(); gl_comm = 1; MakeLine(buf); }
// output an instruction and its operands void idaapi out(void) { char buf[MAXSTR]; init_output_buffer(buf, sizeof(buf)); // setup the output pointer // if this DSP instruction in executed in parallel with a NOP instruction // (example: nop || machi r1, r2), first print the NOP. if ( cmd.segpref & NEXT_INSN_PARALLEL_DSP ) { out_line("nop", COLOR_INSN); OutChar(' '); out_symbol('|'); out_symbol('|'); OutChar(' '); } char postfix[3]; // postfix to eventually insert after the insn name postfix[0] = '\0'; // postfix is null by default // use synthetic option is selected if ( use_synthetic_insn() ) { if ( cmd.segpref & SYNTHETIC_SHORT ) qstrncpy(postfix, (cmd.itype == m32r_ldi ? "8" : ".s"), sizeof(postfix)); if ( cmd.segpref & SYNTHETIC_LONG ) qstrncpy(postfix, (cmd.itype == m32r_ldi ? "16" : ".l"), sizeof(postfix)); } OutMnem(8, postfix); out_one_operand(0); // output the first operand if ( cmd.Op2.type != o_void ) { out_symbol(','); OutChar(' '); out_one_operand(1); // output the second operand } if ( cmd.Op3.type != o_void ) { out_symbol(','); OutChar(' '); out_one_operand(2); // output the third operand } // output a character representation of the immediate values // embedded in the instruction as comments if ( isVoid(cmd.ea,uFlag,0) ) OutImmChar(cmd.Op1); if ( isVoid(cmd.ea,uFlag,1) ) OutImmChar(cmd.Op2); if ( isVoid(cmd.ea,uFlag,2) ) OutImmChar(cmd.Op3); // print a parallel NOP instruction unless the current instruction // is either push or pop (in this special case, nop cannot be executed in //) if ( (cmd.itype != m32r_push && cmd.itype != m32r_pop) && cmd.segpref & NEXT_INSN_PARALLEL_NOP ) { // don't print NOP if the instruction was ld/st reg, fp, and has been converted to ld/st reg, @(arg, fp) // (in other words, in the second operand is a stack variable). // because the o_displ form of ld/st insn is 32 bits, and cannot handle a parallel nop. if ( (cmd.itype != m32r_ld && cmd.itype != m32r_st) || !isStkvar1(uFlag) ) { if ( cmd.Op1.type != o_void ) OutChar(' '); out_symbol('|'); out_symbol('|'); OutChar(' '); out_line("nop", COLOR_INSN); } } if ( cmd.segpref & NEXT_INSN_PARALLEL_OTHER ) { if ( cmd.Op1.type != o_void ) OutChar(' '); out_symbol('|'); out_symbol('|'); out_symbol('\\'); } term_output_buffer(); // terminate the output string gl_comm = 1; // ask to attach a possible user- // defined comment to it MakeLine(buf); // pass the generated line to the // kernel }
const char *Operand::string() const { static char string[256]; if(isVoid(type)) { return 0; } else if(isImm(type)) { if(reference) { return reference; } else { if(value <= 127 && value >= -128) { snprintf(string, 255, "0x%0.2X", value & 0xFF); } else if(value <= 32767 && value -32768) { snprintf(string, 255, "0x%0.4X", value & 0xFFFF); } else { snprintf(string, 255, "0x%0.8X", value); } } } else if(isReg(type)) { return regName(); } else if(isMem(type)) { switch(type) { case OPERAND_MEM8: snprintf(string, 255, "byte ptr ["); break; case OPERAND_MEM16: snprintf(string, 255, "word ptr ["); break; case OPERAND_MEM32: snprintf(string, 255, "dword ptr ["); break; case OPERAND_MEM64: snprintf(string, 255, "qword ptr ["); break; case OPERAND_MEM128: snprintf(string, 255, "xmmword ptr ["); break; case OPERAND_MEM: default: snprintf(string, 255, "byte ptr ["); } if(baseReg != Encoding::REG_UNKNOWN) { snprintf(string, 255, "%s%s", string, regName()); if(indexReg != Encoding::REG_UNKNOWN) { snprintf(string, 255, "%s+", string); } } if(indexReg != Encoding::REG_UNKNOWN) { snprintf(string, 255, "%s%s", string, indexName()); } switch(scale) { case 0: case 1: break; case 2: snprintf(string, 255, "%s*2", string); break; case 4: snprintf(string, 255, "%s*4", string); break; case 8: snprintf(string, 255, "%s*8", string); break; default: throw INTERNAL_ERROR; } if(displacement) { if(baseReg != Encoding::REG_UNKNOWN || indexReg != Encoding::REG_UNKNOWN) { snprintf(string, 255, "%s+", string); } if(reference) { snprintf(string, 255, "%s%s", string, reference); } else { if(displacement <= 32767 && displacement >= -32768) { snprintf(string, 255, "%s%d", string, displacement); } else { snprintf(string, 255, "%s0x%0.8X", string, displacement); } } } snprintf(string, 255, "%s]", string); } else { throw INTERNAL_ERROR; } return strlwr(string); }
bool Operand::isVoid(const Operand &operand) { return isVoid(operand.type); }