void KNFileSearcher::analysisUrls(QStringList urls) { for(auto i=urls.begin(); i!=urls.end(); ++i) { QFileInfo typeChecker(*i); //Analysis the current items. if(typeChecker.isDir()) { emit requireAnlaysisFolder(*i); } if(typeChecker.isFile()) { emit requireAnalysisFile(typeChecker.suffix(), *i); } } }
void KNFileSearcher::analysisNext() { //Check the queue first. if(m_queue.isEmpty()) { return; } //Get the first path in the queue, use QFileInfo to parse it. QFileInfo typeChecker(m_queue.takeFirst()); //Check whether it's a dir. if(typeChecker.isDir()) { analysisFolder(typeChecker); } else if(typeChecker.isFile()) { analysisFile(typeChecker); } //Emit the parse next signal. emit requireAnalysisNext(); }
int OPTaccumulatorsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int i, limit,slimit; InstrPtr p,q; Module scope = cntxt->nspace; int actions = 0; InstrPtr *old; Lifespan span; (void) pci; (void) stk; /* to fool compilers */ span = setLifespan(mb); if( span == NULL) return 0; old= mb->stmt; limit= mb->stop; slimit= mb->ssize; if ( newMalBlkStmt(mb,mb->stop) < 0){ GDKfree(span); return 0; } for (i = 0; i < limit; i++) { p = old[i]; if( getModuleId(p) != batcalcRef ) { pushInstruction(mb,p); continue; } OPTDEBUGaccumulators printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); if (p->retc==1 && p->argc == 2) { /* unary operation, avoid clash with binary */ pushInstruction(mb,p); continue; } if( getLastUpdate(span,getArg(p,0)) != i ) { /* only consider the last update to this variable */ pushInstruction(mb,p); continue; } if (p->retc==1 && p->argc == 3 && isaBatType(getArgType(mb,p,0))) { int b1 =getEndLifespan(span,getArg(p,1))<=i && getArgType(mb,p,1) == getArgType(mb,p,0); int b2 =getEndLifespan(span,getArg(p,2))<=i && getArgType(mb,p,2) == getArgType(mb,p,0) ; if ( b1 == 0 && b2 == 0){ pushInstruction(mb,p); continue; } /* binary/unary operation, check arguments for being candidates */ q= copyInstruction(p); p= pushBit(mb,p, b1); p= pushBit(mb,p, b2); typeChecker(cntxt->fdout, scope, mb, p, TRUE); if (mb->errors || p->typechk == TYPE_UNKNOWN) { OPTDEBUGaccumulators{ mnstr_printf(cntxt->fdout,"# Failed typecheck"); printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL); } /* reset instruction error buffer */ cntxt->errbuf[0]=0; mb->errors = 0; freeInstruction(p); p=q; /* restore */ } else {
bool KNFileSearcher::isFilePathAccept(const QString &filePath) { //This function is using for a quick check of a file path. QFileInfo typeChecker(filePath); return isSuffixAccept(typeChecker.suffix()); }
str OPTgeneratorImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { InstrPtr p,q, *old, *series; int i, k, limit, slimit, actions=0; str m; str bteRef = getName("bte"); str shtRef = getName("sht"); str intRef = getName("int"); str lngRef = getName("lng"); str fltRef = getName("flt"); str dblRef = getName("dbl"); char buf[256]; lng usec= GDKusec(); (void) cntxt; (void) stk; (void) pci; series = (InstrPtr*) GDKzalloc(sizeof(InstrPtr) * mb->vtop); if(series == NULL) throw(MAL,"optimizer.generator", SQLSTATE(HY001) MAL_MALLOC_FAIL); old = mb->stmt; limit = mb->stop; slimit = mb->ssize; // check applicability first for( i=0; i < limit; i++){ p = old[i]; if ( getModuleId(p) == generatorRef && getFunctionId(p) == seriesRef) break; } if (i == limit) { GDKfree(series); return 0; } if (newMalBlkStmt(mb, mb->ssize) < 0) { GDKfree(series); throw(MAL,"optimizer.generator", SQLSTATE(HY001) MAL_MALLOC_FAIL); } for( i=0; i < limit; i++){ p = old[i]; if (p->token == ENDsymbol){ pushInstruction(mb,p); break; } if ( getModuleId(p) == generatorRef && getFunctionId(p) == seriesRef){ series[getArg(p,0)] = p; setModuleId(p, generatorRef); setFunctionId(p, parametersRef); typeChecker(cntxt->usermodule, mb, p, TRUE); pushInstruction(mb,p); } else if ( getModuleId(p) == algebraRef && getFunctionId(p) == selectRef && series[getArg(p,1)]){ errorCheck(p,algebraRef,getArg(p,1)); } else if ( getModuleId(p) == algebraRef && getFunctionId(p) == thetaselectRef && series[getArg(p,1)]){ errorCheck(p,algebraRef,getArg(p,1)); } else if ( getModuleId(p) == algebraRef && getFunctionId(p) == projectionRef && series[getArg(p,2)]){ errorCheck(p,algebraRef,getArg(p,2)); } else if ( getModuleId(p) == sqlRef && getFunctionId(p) == putName("exportValue") && isaBatType(getArgType(mb,p,0)) ){ // interface expects scalar type only, not expressable in MAL signature mb->errors=createException(MAL, "generate_series", SQLSTATE(42000) "internal error, generate_series is a table producing function"); }else if ( getModuleId(p) == batcalcRef && getFunctionId(p) == bteRef && series[getArg(p,1)] && p->argc == 2 ){ casting(bte); } else if ( getModuleId(p) == batcalcRef && getFunctionId(p) == shtRef && series[getArg(p,1)] && p->argc == 2 ){ casting(sht); } else if ( getModuleId(p) == batcalcRef && getFunctionId(p) == intRef && series[getArg(p,1)] && p->argc == 2 ){ casting(int); } else if ( getModuleId(p) == batcalcRef && getFunctionId(p) == lngRef && series[getArg(p,1)] && p->argc == 2 ){ casting(lng); } else if ( getModuleId(p) == batcalcRef && getFunctionId(p) == fltRef && series[getArg(p,1)] && p->argc == 2 ){ casting(flt); } else if ( getModuleId(p) == batcalcRef && getFunctionId(p) == dblRef && series[getArg(p,1)] && p->argc == 2 ){ casting(dbl); } else if ( getModuleId(p) == languageRef && getFunctionId(p) == passRef ) pushInstruction(mb,p); else { // check for use without conversion for(k = p->retc; k < p->argc; k++) if( series[getArg(p,k)]){ m = getModuleId(p); setModuleId(p, generatorRef); typeChecker(cntxt->usermodule, mb, p, TRUE); if(p->typechk == TYPE_UNKNOWN){ setModuleId(p,m); typeChecker(cntxt->usermodule, mb, p, TRUE); setModuleId(series[getArg(p,k)], generatorRef); setFunctionId(series[getArg(p,k)], seriesRef); typeChecker(cntxt->usermodule, mb, series[getArg(p,k)], TRUE); } } pushInstruction(mb,p); } } for (i++; i < limit; i++) pushInstruction(mb, old[i]); for (; i < slimit; i++) if (old[i]) freeInstruction(old[i]); GDKfree(old); GDKfree(series); #ifdef VLT_DEBUG fprintFunction(stderr,mb,0,LIST_MAL_ALL); #endif /* Defense line against incorrect plans */ /* all new/modified statements are already checked */ //chkTypes(cntxt->usermodule, mb, FALSE); //chkFlow(mb); //chkDeclarations(mb); /* keep all actions taken as a post block comment */ usec = GDKusec()- usec; snprintf(buf,256,"%-20s actions=%2d time=" LLFMT " usec","generator",actions, usec); newComment(mb,buf); if( actions >= 0) addtoMalBlkHistory(mb); return MAL_SUCCEED; }