/*--------------------------------------------------------------------------*/ IsotimeEpoch _isotime2epoch(const char * isotime_s) { char osign_c; long osign; long year=0, month=0, day=0, hh=0, mm=0, ss=0; long Hh=0, Mm=0, Ss=0; double uuuuuu=0.0; char trimmed[TRIMLEN], *pd, *pt, *pf, *po, *pr; char datbuf[DLEN]; char timbuf[TLEN]; char frabuf[FLEN]; char offbuf[OLEN]; IsotimeEpoch epoch; if (ISOTIME_debug>0) fprintf(stderr,"_isotime2epoch >>%s<< BEGIN\n", isotime_s); // trim isotime_s, convert to uppercase and copy to trimmed pd = trim( trimmed, TRIMLEN, isotime_s ); if (ISOTIME_debug>1) fprintf(stderr," trim returns >>%s<<\n",pd); // copy date pt = cpd( datbuf, DLEN, pd ); if (ISOTIME_debug>1) fprintf(stderr," date >>%s<<\n",datbuf); // copy time pf = cpt( timbuf, TLEN, pt ); if (ISOTIME_debug>1) fprintf(stderr," time >>%s<<\n",timbuf); // copy fraction po = cpf( frabuf, FLEN, pf ); if (ISOTIME_debug>1) fprintf(stderr," fraction >>%s<<\n",frabuf); // copy offset pr = cpo( offbuf, OLEN, po ); if (ISOTIME_debug>1) fprintf(stderr," offset >>%s<<\n",offbuf); sscanf(datbuf,"%4ld%2ld%2ld",&year,&month,&day); sscanf(timbuf,"%2ld%2ld%2ld",&hh,&mm,&ss); sscanf(frabuf,"%lf",&uuuuuu); sscanf(offbuf,"%c%2ld%2ld%2ld",&osign_c,&Hh, &Mm, &Ss); if ( strlen(pr)||(day==0) ) month=0; // error, if rest is not empty or day 0 osign = (osign_c=='-')?-1:+1; epoch = _convert2epoch(year,month,day,hh,mm,ss,uuuuuu,osign,Hh,Mm,Ss); if ( epoch.status ) { fprintf( stderr, "ERROR: Cannot read time \"%s\"\n",trimmed ); fprintf( stderr, " Format: YYYY-MM-DDThh:mm:ss[.uuuuuu][+Hh:Mm]\n" ); } if (ISOTIME_debug>0) fprintf(stderr,"_isotime2epoch >>%s<< END\n", isotime_s); return( epoch ); } // _isotime2epoch
void Marm_ClipChildren(CWnd* pThis, CDC* pDC) { if ((NULL == pThis) || (NULL == pDC)) return; CLIP_CHILDREN_PROC_DATA cpd(pThis->GetSafeHwnd(), *pDC); if (::IsWindow(cpd.DialogHWnd())) { const UINT dwStyle = ::GetWindowLong(cpd.DialogHWnd(), GWL_STYLE); if (0 != (dwStyle & WS_VISIBLE)) { EnumChildWindows(pThis->GetSafeHwnd(), Marm_ClipChildrenProc, (LPARAM)&cpd); } } }
void ScorerManager::parseConstraintPair() { emit( message("Parse constraint pair starts: ") ); this->connectPairs_.clear(); this->otherPairs_.clear(); for ( int i = 0; i < this->actualInputGraphs_.size(); ++i) { PairRelationDetector cpd(this->actualInputGraphs_[i], i, normalizeCoef_, this->isUseLink_, true, logLevel_); cpd.detect(this->actualInputGraphs_[(i+1)%this->actualInputGraphs_.size()], this->gcorr_->correspondences); this->connectPairs_.push_back(cpd.connectedPairs_); this->otherPairs_.push_back(cpd.otherPairs_); if (this->logLevel_) { saveToFile("pair_relation-" + QString::number(i) + ".txt", cpd.otherPairs_); } } emit( message("Parse constraint pairs end. ") ); }
DataInformation* toDataInformation(const QScriptValue& value, const ParserInfo& oldInfo) { if (!value.isValid()) { oldInfo.error() << "invalid value passed!"; return 0; } ParserInfo info(oldInfo); QString nameOverride = value.property(PROPERTY_NAME).toString(); if (!nameOverride.isEmpty()) info.name = nameOverride; //check function array and date, since they are objects too if (value.isRegExp()) { //apparently regexp is a function info.error() << "Cannot convert a RegExp object to DataInformation!"; return 0; } if (value.isFunction()) { info.error() << "Cannot convert a Function object to DataInformation!"; return 0; } if (value.isArray()) { info.error() << "Cannot convert a Array object to DataInformation!"; return 0; } if (value.isDate()) { info.error() << "Cannot convert a Date object to DataInformation!"; return 0; } if (value.isError()) { info.error() << "Cannot convert a Error object to DataInformation!"; return 0; } //variant and qobject are also object types, however they cannot appear from user code, no need to check //if it is a string, we convert to primitive type, if not it has to be an object if (value.isString()) return toPrimitive(value, info); //a type string is also okay if (!value.isObject()) { if (value.isBool()) info.error() << "Cannot convert Boolean to DataInformation!"; else if (value.isNull()) info.error() << "Cannot convert null to DataInformation!"; else if (value.isUndefined()) info.error() << "Cannot convert undefined to DataInformation!"; else if (value.isNumber()) info.error() << "Cannot convert Number to DataInformation!"; else info.error() << "Cannot convert object of unknown type to DataInformation!"; return 0; //no point trying to convert } QString type = value.property(PROPERTY_INTERNAL_TYPE).toString(); if (type.isEmpty()) { info.error() << "Cannot convert object since type of object could not be determined!"; return 0; } DataInformation* returnVal = 0; if (type == TYPE_ARRAY) returnVal = toArray(value, info); else if (type == TYPE_STRUCT) returnVal = toStruct(value, info); else if (type == TYPE_UNION) returnVal = toUnion(value, info); else if (type == TYPE_BITFIELD) returnVal = toBitfield(value, info); else if (type == TYPE_ENUM) returnVal = toEnum(value, false, info); else if (type == TYPE_FLAGS) returnVal = toEnum(value, true, info); else if (type == TYPE_STRING) returnVal = toString(value, info); else if (type == TYPE_POINTER) returnVal = toPointer(value, info); else if (type == TYPE_TAGGED_UNION) returnVal = toTaggedUnion(value, info); else if (type == TYPE_PRIMITIVE) returnVal = toPrimitive(value, info); else info.error() << "Unknown type:" << type; if (returnVal) { CommonParsedData cpd(info); QString byteOrderStr = value.property(PROPERTY_BYTEORDER).toString(); if (!byteOrderStr.isEmpty()) cpd.endianess = ParserUtils::byteOrderFromString(byteOrderStr, LoggerWithContext(info.logger, info.context())); cpd.updateFunc = value.property(PROPERTY_UPDATE_FUNC); cpd.validationFunc = value.property(PROPERTY_VALIDATION_FUNC); cpd.toStringFunc = value.property(PROPERTY_TO_STRING_FUNC); cpd.customTypeName = value.property(PROPERTY_CUSTOM_TYPE_NAME).toString(); if (!DataInformationFactory::commonInitialization(returnVal, cpd)) { delete returnVal; //error message has already been logged return 0; } } return returnVal; }