bool SpecailMatcher::run(const OJString & answerOutputFile, const OJString & userOutputFile) { result_ = MatcherCode::SystemError; return isAccept(); }
/***************************************************************************************************** * expressionIFBlock -> faz analise da expressao logica do IF * __IF => referencia para a raiz ****************************************************************************************************/ void Syntactic::expressionIFBlock(IFElse *__if){ TokenType *buffer, *token, *temp; buffer = lex->getToken(); if(buffer->getToken() == "("){ buffer = lex->getToken(); if(isAccept(buffer->getClasse())){ token = lex->getToken(); //verifica se o token tem um tipo if( (temp = prod->getTokenOfList(buffer->getToken())) != NULL) buffer->setType(temp->getType()); prod->insert(buffer); //analize semantica if(isLogical(token->getClasse()) || isRelational(token->getClasse())){ Operator *op = new Operator(); op->setOperator(token); //seta operador logico/relacional op->setLeft(buffer); //coloca var ou digito ou string a esquerda buffer = lex->getToken(); if(isAccept(buffer->getClasse())) { op->setRight(buffer); //coloca var ou digito ou string a direita //verifica se existe na lista de producoes e pega o tipo if( (temp = prod->getTokenOfList(buffer->getToken())) != NULL) buffer->setType(temp->getType()); prod->insert(buffer); //analize semantica } else erro->showError(" variavel, inteiro, real ou string esperado mas: ", buffer->getLine(), buffer->getColumn(), buffer->getToken()); __if->setExpression(op); //seta expressao logica } else erro->showError(" & ou | esperado mas: ", token->getLine(), token->getColumn(), token->getToken()); } else erro->showError(" variavel, inteiro, real ou string esperado mas: ", buffer->getLine(), buffer->getColumn(), buffer->getToken()); buffer = lex->getToken(); //verifica se tem o fecha parenteses if(buffer->getToken() != ")") erro->showError(" ) esperado mas: ", buffer->getLine(), buffer->getColumn(), buffer->getToken()); } else erro->showError(" ( esperado mas: ", buffer->getLine(), buffer->getColumn(), buffer->getToken()); }
bool CCompiler::run( const OJString & codeFile, const OJString & exeFile, const OJString & compileFile) { OJString cmdLine; FormatString(cmdLine, CompileArg::cmd.c_str(), codeFile.c_str(), exeFile.c_str()); IMUST::WindowsProcess wp(OJStr(""), compileFile); wp.create(cmdLine, CompileArg::limitTime, CompileArg::limitMemory); result_ = wp.getExitCodeEx(); return isAccept(); }
bool ExeExcuter::run( const OJString & exeFile, const OJString & inputFile, const OJString & outputFile, OJInt32_t limitTime, OJInt32_t limitMemory ) { ProcessPtr wp = ProcessFactory::create(ProcessType::WithUser, inputFile, outputFile); wp->create(exeFile, limitTime, limitMemory); result_ = wp->getExitCodeEx(); runTime_ = wp->getRunTime(); runMemory_ = wp->getRunMemory(); return isAccept(); }
/*------------------------------------*/ void putStone(const Stone *stones, int first, int n, int *map, int x1, int y1, int x2, int y2) { int i, x, y, j, k; int tmpmap[1024]; memcpy(tmpmap, map, sizeof(int) * 1024); int ids[256]; for (i=0; i<n; i++) ids[i] = (first + i) % n; for (i=0; i<n; i++) { int id = ids[i]; int8_t operation[256]; BlockDefineOperation(stones[id].list, operation); for (y=y1; y<y2; y++) { for (x=(x2-1); x>=x1; x--) { for (j=0; j<8; j++) { int8_t *p = &operation[j << 5]; if (p[0] == INT8_MAX) continue; for (k=0; k<stones[id].len; k++) { int xx = x + p[k << 1]; int yy = y + p[(k << 1) + 1]; if (!((x1 <= xx) && (xx < x2)) || !((y1 <= yy) && (yy < y2))) goto DAMEDESU; int idx = (yy << 5) + xx; if (tmpmap[idx] != -1) goto DAMEDESU; tmpmap[idx] = stones[id].id; } if (isAccept(tmpmap, x1, y1, x2, y2)) goto NEXT; DAMEDESU: memcpy(tmpmap, map, sizeof(int) * 1024); continue; } } } NEXT: memcpy(map, tmpmap, sizeof(int) * 1024); continue; // noop } }