void FileMap::addUnknownChannel(const eString& chanId) { isDirty = initDone; if (!isUnknown(chanId)) unknown.insert(chanId); if (isIgnored(chanId)) removeIgnoredChannel(chanId); if (isMapped(chanId)) removeMappedChannel(chanId); eString s = (isUnknown(chanId) && !isIgnored(chanId) && !isMapped(chanId)) ? "succeeded" : "failed"; std::cout << "Adding unknown " << chanId << ": " << s << std::endl; }
Cardinality& Cardinality::operator+=(const Cardinality& c) { if (isUnknown()) { return *this; } else if (c.isUnknown()) { d_card = s_unknownCard; return *this; } if (c.isFinite() && isLargeFinite()) { return *this; } else if (isFinite() && c.isLargeFinite()) { d_card = s_largeFiniteCard; return *this; } if (isFinite() && c.isFinite()) { d_card += c.d_card - 1; return *this; } if (compare(c) == LESS) { return *this = c; } else { return *this; } Unreachable(); }
/** Assigning multiplication of this cardinality with another. */ Cardinality& Cardinality::operator*=(const Cardinality& c) { if (isUnknown()) { return *this; } else if (c.isUnknown()) { d_card = s_unknownCard; return *this; } if (c.isFinite() && isLargeFinite()) { return *this; } else if (isFinite() && c.isLargeFinite()) { d_card = s_largeFiniteCard; return *this; } if (compare(0) == EQUAL || c.compare(0) == EQUAL) { return *this = 0; } else if (!isFinite() || !c.isFinite()) { if (compare(c) == LESS) { return *this = c; } else { return *this; } } else { d_card -= 1; d_card *= c.d_card - 1; d_card += 1; return *this; } Unreachable(); }
char *blankOutUnknown(char *text) /* Return empty string in place of uninformative text. */ { if (isUnknown(text)) text = ""; return text; }
void FileMap::addMappedChannel(const eString& chanId, const eString& ref) { isDirty = initDone; std::cout << "Adding map " << chanId << ", " << ref << std::endl; if (isMapped(chanId)) removeMappedChannel(chanId); if (isIgnored(chanId)) removeIgnoredChannel(chanId); if (isUnknown(chanId)) removeUnknownChannel(chanId); mapped.insert(chanId); map[chanId] = ref; }
bool ASTType::isDerivedFrom(const ASTType& that) const { if ( !isUnknown() && !that.isUnknown() ) { return that.getObjectClass().isBase(getObjectClass()) || that.getObjectClass().isImplementing(getObjectClass()); } return false; }
void isUnknown_test(void) { WorldMap wm; XYPos pos; bool test; /* * +-+-+-+ * | | | * + + +-+ * |X . | * +-+ + + * | X| | * +-+-+-+ */ wm.xlen = 3; wm.ylen = 3; initWorldMap(&wm); pos.x = 1; pos.y = 1; addToWorldMap(&wm, pos, N, OPEN); addToWorldMap(&wm, pos, S, OPEN); addToWorldMap(&wm, pos, W, OPEN); pos.x = 0; pos.y = 1; markSquareAsDead(&wm, pos); pos.x = 1; pos.y = 2; markSquareAsDead(&wm, pos); pos.x = 2; pos.y = 1; test = isUnknown(wm, pos, W); assert(test == true); addToWorldMap(&wm, pos, N, WALL); test = isUnknown(wm, pos, N); assert(test == false); }
void genotypeAndStrainFromKey(char *genotypeKey, struct sqlConnection *conn, char **retGenotype, char **retStrain) /* Return dynamically allocated string describing genotype */ { int key = atoi(genotypeKey); char *genotype = NULL, *strain = NULL; if (key > 0) { struct dyString *query = dyStringNew(0); struct dyString *geno = dyStringNew(256); struct sqlResult *sr; char **row; /* Figure out genotype. Create string that looks something like: * adh:cheap date,antp:+, * That is a comma separated list gene:allele. */ sqlDyStringPrintf(query, "select MRK_Marker.symbol,ALL_Allele.symbol " "from GXD_AlleleGenotype,MRK_Marker,ALL_Allele " "where GXD_AlleleGenotype._Genotype_key = %s " "and GXD_AlleleGenotype._Marker_key = MRK_Marker._Marker_key " "and GXD_AlleleGenotype._Allele_key = ALL_Allele._Allele_key " , genotypeKey); sr = sqlGetResultVerbose(conn, query->string); while ((row = sqlNextRow(sr)) != NULL) dyStringPrintf(geno, "%s:%s,", row[0], row[1]); sqlFreeResult(&sr); genotype = dyStringCannibalize(&geno); /* Figure out strain */ dyStringClear(query); sqlDyStringPrintf(query, "select PRB_Strain.strain from GXD_Genotype,PRB_Strain " "where GXD_Genotype._Genotype_key = %s " "and GXD_Genotype._Strain_key = PRB_Strain._Strain_key" , genotypeKey); strain = sqlQuickStringVerbose(conn, query->string); if (isUnknown(strain)) freez(&strain); dyStringFree(&query); } if (genotype == NULL) genotype = cloneString(""); if (strain == NULL) strain = cloneString(""); *retGenotype = genotype; *retStrain = strain; }
bool CalcType::checkInputVariable(int i) { if(isUnknown(mIns.at(i))) { QString help = mIns.at(i); bool isNumber; mIns.at(i).toDouble(&isNumber); if(isNumber) mIns.append(QString("Operand-%1-IsNumber").arg(i)); else { error(FUNC, tr("'%1': Variable at position %1 not found: %2").arg(i + 1).arg(mIns.at(i)).arg(mType)); return false; } } mUsedVariables->insert(mIns.at(i)); return true; }
KmerAffect &KmerAffect::operator+=(const KmerAffect &kmer) { if (kmer.affect != affect) { if (isUnknown()) *this = kmer; else if (affect_char(affect) == affect_char(kmer.affect) && (affect_strand(affect) != affect_strand(kmer.affect))) { // Same label but different strand // -> we put ambiguous, we could have something to say that // strand is ambiguous but not the label, but we don't have enough space // in 1 byte… *this = AFFECT_AMBIGUOUS; affect.length = kmer.getLength(); } else { assert(affect.c != kmer.affect.c || getLength() == kmer.getLength()); *this = AFFECT_AMBIGUOUS; affect.length = kmer.getLength(); } } return *this; }
Cardinality::CardinalityComparison Cardinality::compare(const Cardinality& c) const throw() { if(isUnknown() || c.isUnknown()) { return UNKNOWN; } else if(isLargeFinite()) { if(c.isLargeFinite()) { return UNKNOWN; } else if(c.isFinite()) { return GREATER; } else { Assert(c.isInfinite()); return LESS; } } else if(c.isLargeFinite()) { if(isLargeFinite()) { return UNKNOWN; } else if(isFinite()) { return LESS; } else { Assert(isInfinite()); return GREATER; } } else if(isInfinite()) { if(c.isFinite()) { return GREATER; } else { return d_card < c.d_card ? GREATER : (d_card == c.d_card ? EQUAL : LESS); } } else if(c.isInfinite()) { Assert(isFinite()); return LESS; } else { Assert(isFinite() && !isLargeFinite()); Assert(c.isFinite() && !c.isLargeFinite()); return d_card < c.d_card ? LESS : (d_card == c.d_card ? EQUAL : GREATER); } Unreachable(); }
BOOL get_vtbl_info(ea_t ea_address, VTBL_info_t &vtbl_info) { flags_t flags = getFlags(ea_address); if (!(hasRef(flags) || has_any_name(flags) && (isDwrd(flags) || isUnknown(flags)))) return(FALSE); else { BOOL is_move_xref = FALSE; ea_t ea_code_ref = get_first_dref_to(ea_address); if (ea_code_ref && (ea_code_ref != BADADDR)) { do { if (isCode(getFlags(ea_code_ref))) { LPCTSTR disasm_line = get_text_disasm(ea_code_ref); #ifndef __EA64__ if ((*((PUINT)disasm_line) == 0x20766F6D /*"mov "*/) && (strstr(disasm_line + 4, " offset ") != NULL)) #else if ((*((PUINT)disasm_line) == 0x2061656c /*"lea "*/) && (strstr(disasm_line + 4, "rcx") != NULL) && (strstr(disasm_line + 4, "const") != NULL)) #endif { is_move_xref = TRUE; break; } } ea_code_ref = get_next_dref_to(ea_address, ea_code_ref); } while (ea_code_ref && (ea_code_ref != BADADDR)); } if (!is_move_xref) return(FALSE); ZeroMemory(&vtbl_info, sizeof(VTBL_info_t)); // get_name(BADADDR, ea_address, vtbl_info.vtbl_name, (MAXSTR - 1)); f_get_ea_name(&vtbl_info.vtbl_name, ea_address); ea_t ea_start = vtbl_info.ea_begin = ea_address; while (TRUE) { flags_t index_flags = getFlags(ea_address); #ifndef __EA64__ if (!(hasValue(index_flags) && (isDwrd(index_flags) || isUnknown(index_flags)))) #else if (!(hasValue(index_flags) && (isQwrd(index_flags) || isUnknown(index_flags)))) #endif break; #ifndef __EA64__ ea_t ea_index_value = get_32bit(ea_address); #else ea_t ea_index_value = get_64bit(ea_address); #endif if (!(ea_index_value && (ea_index_value != BADADDR))) break; if (ea_address != ea_start) if (hasRef(index_flags)) break; flags_t value_flags = getFlags(ea_index_value); if (!isCode(value_flags)) break; else if (isUnknown(index_flags)) #ifndef __EA64__ doDwrd(ea_address, sizeof(DWORD)); ea_address += sizeof(UINT); #else doQwrd(ea_address, sizeof(UINT64)); ea_address += sizeof(UINT64); #endif }; #ifndef __EA64__ if ((vtbl_info.methods = ((ea_address - ea_start) / sizeof(UINT))) > 0) #else if((vtbl_info.methods = ((ea_address - ea_start) / sizeof(UINT64))) > 0) #endif { vtbl_info.ea_end = ea_address; return(TRUE); } else return(FALSE); } }
bool KmerAffect::isNull() const { return isUnknown(); }
bool KmerAffect::isGeneric() const { return !(isUnknown() || isAmbiguous()); }
void FileMap::removeUnknownChannel(const eString& chanId) { unknown.erase(chanId); eString s = isUnknown(chanId) ? "failed" : "succeeded"; std::cout << "Removing unknown " << chanId << ": " << s << std::endl; }
Integer Cardinality::getBethNumber() const { PrettyCheckArgument(!isFinite() && !isUnknown(), *this, "This cardinality is not infinite (or is unknown)."); return -d_card - 1; }
/** Assigning exponentiation of this cardinality with another. */ Cardinality& Cardinality::operator^=(const Cardinality& c) { if (isUnknown()) { return *this; } else if (c.isUnknown()) { d_card = s_unknownCard; return *this; } if (c.isFinite() && isLargeFinite()) { return *this; } else if (isFinite() && c.isLargeFinite()) { d_card = s_largeFiniteCard; return *this; } if (c.compare(0) == EQUAL) { // (anything) ^ 0 == 1 d_card = 2; // remember, +1 for finite cardinalities return *this; } else if (compare(0) == EQUAL) { // 0 ^ (>= 1) == 0 return *this; } else if (compare(1) == EQUAL) { // 1 ^ (>= 1) == 1 return *this; } else if (c.compare(1) == EQUAL) { // (anything) ^ 1 == (that thing) return *this; } else if (isFinite() && c.isFinite()) { // finite ^ finite == finite try { // Note: can throw an assertion if c is too big for // exponentiation if (d_card - 1 >= 2 && c.d_card - 1 >= 64) { // don't bother, it's too large anyways d_card = s_largeFiniteCard; } else { d_card = (d_card - 1).pow(c.d_card.getUnsignedLong() - 1) + 1; } } catch (IllegalArgumentException&) { d_card = s_largeFiniteCard; } return *this; } else if (!isFinite() && c.isFinite()) { // inf ^ finite == inf return *this; } else { Assert(compare(2) != LESS && !c.isFinite(), "fall-through case not as expected:\n%s\n%s", this->toString().c_str(), c.toString().c_str()); // (>= 2) ^ beth_k == beth_(k+1) // unless the base is already > the exponent if (compare(c) == GREATER) { return *this; } d_card = c.d_card - 1; return *this; } Unreachable(); }
Result::UnknownExplanation Result::whyUnknown() const { PrettyCheckArgument(isUnknown(), this, "This result is not unknown, so the reason for " "being unknown cannot be inquired of it"); return d_unknownExplanation; }
int KmerAffect::getStrand() const{ if (isUnknown() || isAmbiguous()) return 0; return affect_strand(affect); }
// Attempt to get information of and fix vftable at address // Return TRUE along with info if valid vftable parsed at address BOOL vftable::getTableInfo(ea_t ea, vtinfo &info) { ZeroMemory(&info, sizeof(vtinfo)); // Start of a vft should have an xref and a name (auto, or user, etc). // Ideal flags 32bit: FF_DWRD, FF_0OFF, FF_REF, FF_NAME, FF_DATA, FF_IVL //dumpFlags(ea); flags_t flags = get_flags_novalue(ea); if(hasRef(flags) && has_any_name(flags) && (isEa(flags) || isUnknown(flags))) { // Get raw (auto-generated mangled, or user named) vft name //if (!get_name(BADADDR, ea, info.name, SIZESTR(info.name))) // msg(EAFORMAT" ** vftable::getTableInfo(): failed to get raw name!\n", ea); // Determine the vft's method count ea_t start = info.start = ea; while (TRUE) { // Should be an ea_t offset to a function here (could be unknown if dirty IDB) // Ideal flags for 32bit: FF_DWRD, FF_0OFF, FF_REF, FF_NAME, FF_DATA, FF_IVL //dumpFlags(ea); flags_t indexFlags = get_flags_novalue(ea); if (!(isEa(indexFlags) || isUnknown(indexFlags))) { //msg(" ******* 1\n"); break; } // Look at what this (assumed vftable index) points too ea_t memberPtr = getEa(ea); if (!(memberPtr && (memberPtr != BADADDR))) { // vft's often have a zero ea_t (NULL pointer?) following, fix it if (memberPtr == 0) fixEa(ea); //msg(" ******* 2\n"); break; } // Should see code for a good vft method here, but it could be dirty flags_t flags = get_flags_novalue(memberPtr); if (!(isCode(flags) || isUnknown(flags))) { //msg(" ******* 3\n"); break; } if (ea != start) { // If we see a ref after first index it's probably the beginning of the next vft or something else if (hasRef(indexFlags)) { //msg(" ******* 4\n"); break; } // If we see a COL here it must be the start of another vftable if (RTTI::_RTTICompleteObjectLocator::isValid(memberPtr)) { //msg(" ******* 5\n"); break; } } // As needed fix ea_t pointer, and, or, missing code and function def here fixEa(ea); fixFunction(memberPtr); ea += sizeof(ea_t); }; // Reached the presumed end of it if ((info.methodCount = ((ea - start) / sizeof(ea_t))) > 0) { info.end = ea; //msg(" vftable: "EAFORMAT"-"EAFORMAT", methods: %d\n", rtInfo.eaStart, rtInfo.eaEnd, rtInfo.uMethods); return(TRUE); } } //dumpFlags(ea); return(FALSE); }