text
stringlengths
1
1.05M
Name: title-j.asm Type: file Size: 58739 Last-Modified: '1992-07-14T15:00:00Z' SHA-1: F6EF0377B2072B014A12FF8E6208A5EE875667EA Description: null
; A048490: a(n)=T(7,n), array T given by A048483. ; Submitted by Christian Krause ; 1,9,25,57,121,249,505,1017,2041,4089,8185,16377,32761,65529,131065,262137,524281,1048569,2097145,4194297,8388601,16777209,33554425,67108857,134217721,268435449,536870905,1073741817,2147483641,4294967289,8589934585,17179869177,34359738361,68719476729,137438953465,274877906937,549755813881,1099511627769,2199023255545,4398046511097,8796093022201,17592186044409,35184372088825,70368744177657,140737488355321,281474976710649,562949953421305,1125899906842617,2251799813685241,4503599627370489 mov $2,2 pow $2,$0 mov $0,$2 sub $0,1 mul $0,8 add $0,1
/* Copyright (c) 2018 vesoft inc. All rights reserved. * * This source code is licensed under Apache 2.0 License, * attached with Common Clause Condition 1.0, found in the LICENSES directory. */ #include "base/Base.h" #include "graph/test/TestEnv.h" #include "graph/test/TestBase.h" #include "graph/test/TraverseTestBase.h" #include "meta/test/TestUtils.h" #include "parser/GQLParser.h" #include "graph/TraverseExecutor.h" #include "graph/GoExecutor.h" namespace nebula { namespace graph { class GoTest : public TraverseTestBase, public ::testing::WithParamInterface<bool>{ protected: void SetUp() override { TraverseTestBase::SetUp(); FLAGS_filter_pushdown = GetParam(); // ... } void TearDown() override { // ... TraverseTestBase::TearDown(); } }; TEST_P(GoTest, OneStepOutBound) { { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "YIELD %ld as vid | GO FROM $-.vid OVER serve"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve YIELD " "$^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2003, 2005, "Hawks"}, {player.name(), 2005, 2008, "Suns"}, {player.name(), 2008, 2012, "Hornets"}, {player.name(), 2012, 2016, "Spurs"}, {player.name(), 2016, 2017, "Jazz"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve YIELD " "$^.player.name, serve.start_year, serve.end_year, $$.team.name" " | LIMIT 1 OFFSET 2"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2012, 2016, "Spurs"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Rajon Rondo"]; auto *fmt = "GO FROM %ld OVER serve WHERE " "serve.start_year >= 2013 && serve.end_year <= 2018 YIELD " "$^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2014, 2015, "Mavericks"}, {player.name(), 2015, 2016, "Kings"}, {player.name(), 2016, 2017, "Bulls"}, {player.name(), 2017, 2018, "Pelicans"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER like YIELD like._dst as id" "| GO FROM $-.id OVER like YIELD like._dst as id | GO FROM $-.id OVER serve"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Hornets"].vid()}, {teams_["Trail Blazers"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER like YIELD like._dst as id" "| ( GO FROM $-.id OVER like YIELD like._dst as id | GO FROM $-.id OVER serve )"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Hornets"].vid()}, {teams_["Trail Blazers"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, AssignmentSimple) { { cpp2::ExecutionResponse resp; auto &player = players_["Tracy McGrady"]; auto *fmt = "$var = GO FROM %ld OVER like YIELD like._dst as id; " "GO FROM $var.id OVER like"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"like._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<uint64_t>> expected = { {players_["Tracy McGrady"].vid()}, {players_["LaMarcus Aldridge"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, AssignmentPipe) { { cpp2::ExecutionResponse resp; auto &player = players_["Tracy McGrady"]; auto *fmt = "$var = (GO FROM %ld OVER like YIELD like._dst as id | GO FROM $-.id OVER like YIELD " "like._dst as id);" "GO FROM $var.id OVER like"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"like._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<uint64_t>> expected = { {players_["Kobe Bryant"].vid()}, {players_["Grant Hill"].vid()}, {players_["Rudy Gay"].vid()}, {players_["Tony Parker"].vid()}, {players_["Tim Duncan"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, VariableUndefined) { { cpp2::ExecutionResponse resp; auto query = "GO FROM $var OVER like"; auto code = client_->execute(query, resp); ASSERT_NE(cpp2::ErrorCode::SUCCEEDED, code); } } TEST_P(GoTest, AssignmentEmptyResult) { { cpp2::ExecutionResponse resp; auto query = "$var = GO FROM -1 OVER like YIELD like._dst as id; " "GO FROM $var.id OVER like"; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<uint64_t>> expected = { }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, OneStepInBound) { { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve REVERSELY"; auto &team = teams_["Thunders"]; auto query = folly::stringPrintf(fmt, team.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { {players_["Russell Westbrook"].vid()}, {players_["Kevin Durant"].vid()}, {players_["James Harden"].vid()}, {players_["Carmelo Anthony"].vid()}, {players_["Paul George"].vid()}, {players_["Ray Allen"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, DISABLED_OneStepInOutBound) { // Ever served in the same team { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve YIELD serve._dst AS id" " | GO FROM $-.id OVER serve REVERSELY"; auto &player = players_["Kobe Bryant"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { {players_["LeBron James"].vid()}, {players_["Rajon Rondo"].vid()}, {players_["Kobe Bryant"].vid()}, {players_["Steve Nash"].vid()}, {players_["Paul Gasol"].vid()}, {players_["Shaquile O'Neal"].vid()}, {players_["JaVale McGee"].vid()}, {players_["Dwight Howard"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // Ever been teammates { } } TEST_P(GoTest, Distinct) { { cpp2::ExecutionResponse resp; auto &player = players_["Nobody"]; auto *fmt = "GO FROM %ld OVER serve " "YIELD DISTINCT $^.player.name as name, $$.team.name as name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER like YIELD like._dst as id" "| GO FROM $-.id OVER like YIELD like._dst as id | GO FROM $-.id OVER serve " "YIELD DISTINCT serve._dst, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t, std::string>> expected = { {teams_["Spurs"].vid(), "Spurs"}, {teams_["Hornets"].vid(), "Hornets"}, {teams_["Trail Blazers"].vid(), "Trail Blazers"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 2 STEPS FROM %ld OVER like YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {3394245602834314645}, {-7579316172763586624}, {5662213458193308137}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, VertexNotExist) { std::string name = "NON EXIST VERTEX ID"; int64_t nonExistPlayerID = std::hash<std::string>()(name); auto iter = players_.begin(); while (iter != players_.end()) { if (iter->vid() == nonExistPlayerID) { ++nonExistPlayerID; iter = players_.begin(); continue; } ++iter; } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve"; auto query = folly::stringPrintf(fmt, nonExistPlayerID); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve YIELD " "$^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, nonExistPlayerID); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve YIELD DISTINCT " "$^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, nonExistPlayerID); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } } TEST_P(GoTest, EmptyInputs) { std::string name = "NON EXIST VERTEX ID"; int64_t nonExistPlayerID = std::hash<std::string>()(name); auto iter = players_.begin(); while (iter != players_.end()) { if (iter->vid() == nonExistPlayerID) { ++nonExistPlayerID; iter = players_.begin(); continue; } ++iter; } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve | GO FROM $-.serve_id OVER serve"; auto query = folly::stringPrintf(fmt, nonExistPlayerID); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._dst as id" "| GO FROM $-.id OVER like YIELD like._dst as id | GO FROM $-.id OVER serve"; auto query = folly::stringPrintf(fmt, nonExistPlayerID); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._dst as id" "| (GO FROM $-.id OVER like YIELD like._dst as id | GO FROM $-.id OVER serve)"; auto query = folly::stringPrintf(fmt, nonExistPlayerID); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } { cpp2::ExecutionResponse resp; std::string fmt = "GO FROM %ld over serve " "YIELD serve._dst as id, serve.start_year as start " "| YIELD $-.id as id WHERE $-.start > 20000" "| Go FROM $-.id over serve"; auto query = folly::stringPrintf(fmt.c_str(), players_["Marco Belinelli"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } } TEST_P(GoTest, MULTI_EDGES) { // Ever served in the same team { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve, like"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Thunders"].vid(), 0}, {0, players_["Paul George"].vid()}, {0, players_["James Harden"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve, like REVERSELY " "YIELD serve._dst, like._dst, serve._type, like._type"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, int64_t, int64_t>> expected = { {0, players_["James Harden"].vid(), 0, -5}, {0, players_["Dejounte Murray"].vid(), 0, -5}, {0, players_["Paul George"].vid(), 0, -5}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve, like REVERSELY YIELD serve._src, like._src"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {0, player.vid()}, {0, player.vid()}, {0, player.vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve, like REVERSELY"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {0, players_["James Harden"].vid()}, {0, players_["Dejounte Murray"].vid()}, {0, players_["Paul George"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * REVERSELY YIELD serve._dst, like._dst"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {0, players_["James Harden"].vid()}, {0, players_["Dejounte Murray"].vid()}, {0, players_["Paul George"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * REVERSELY YIELD serve._src, like._src"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {0, player.vid()}, {0, player.vid()}, {0, player.vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * REVERSELY"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); // edges order: serve, like, teammate. std::vector<std::tuple<int64_t, int64_t, int64_t>> expected = { {0, players_["James Harden"].vid(), 0}, {0, players_["Dejounte Murray"].vid(), 0}, {0, players_["Paul George"].vid(), 0}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like, teammate REVERSELY YIELD like.likeness, " "teammate.start_year, $$.player.name"; auto &player = players_["Manu Ginobili"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, std::string>> expected = { {95, 0, "Tim Duncan"}, {95, 0, "Tony Parker"}, {90, 0, "Tiago Splitter"}, {99, 0, "Dejounte Murray"}, {0, 2002, "Tim Duncan"}, {0, 2002, "Tony Parker"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * REVERSELY YIELD like.likeness, teammate.start_year, " "serve.start_year, $$.player.name"; auto &player = players_["Manu Ginobili"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, int64_t, std::string>> expected = { {95, 0, 0, "Tim Duncan"}, {95, 0, 0, "Tony Parker"}, {90, 0, 0, "Tiago Splitter"}, {99, 0, 0, "Dejounte Murray"}, {0, 2002, 0, "Tim Duncan"}, {0, 2002, 0, "Tony Parker"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve, like " "YIELD serve.start_year, like.likeness, serve._type, like._type"; auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, int64_t, int64_t>> expected = { {2008, 0, 4, 0}, {0, 90, 0, 5}, {0, 90, 0, 5}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve, like"; auto &player = players_["Shaquile O'Neal"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Magic"].vid(), 0}, {teams_["Lakers"].vid(), 0}, {teams_["Heat"].vid(), 0}, {teams_["Suns"].vid(), 0}, {teams_["Cavaliers"].vid(), 0}, {teams_["Celtics"].vid(), 0}, {0, players_["JaVale McGee"].vid()}, {0, players_["Tim Duncan"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * YIELD serve._dst, like._dst"; auto &player = players_["Dirk Nowitzki"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Mavericks"].vid(), 0}, {0, players_["Steve Nash"].vid()}, {0, players_["Jason Kidd"].vid()}, {0, players_["Dwyane Wade"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER *"; auto &player = players_["Paul Gasol"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); // edges order: serve, like, teammate std::vector<std::tuple<int64_t, int64_t, int64_t>> expected = { {teams_["Grizzlies"].vid(), 0, 0}, {teams_["Lakers"].vid(), 0, 0}, {teams_["Bulls"].vid(), 0, 0}, {teams_["Spurs"].vid(), 0, 0}, {teams_["Bucks"].vid(), 0, 0}, {0, players_["Kobe Bryant"].vid(), 0}, {0, players_["Marc Gasol"].vid(), 0}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * YIELD $$.team.name, $$.player.name"; auto &player = players_["LaMarcus Aldridge"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<std::string, std::string>> expected = { {"Trail Blazers", ""}, {"", "Tim Duncan"}, {"", "Tony Parker"}, {"Spurs", ""}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER like, serve YIELD like._dst as id" "| ( GO FROM $-.id OVER like YIELD like._dst as id | GO FROM $-.id OVER serve )"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Hornets"].vid()}, {teams_["Trail Blazers"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER * YIELD like._dst as id" "| ( GO FROM $-.id OVER like YIELD like._dst as id | GO FROM $-.id OVER serve )"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Hornets"].vid()}, {teams_["Trail Blazers"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, ReferencePipeInYieldAndWhere) { { cpp2::ExecutionResponse resp; std::string query = "GO FROM hash('Tim Duncan'),hash('Chris Paul') OVER like " "YIELD $^.player.name AS name, like._dst AS id " "| GO FROM $-.id OVER like " "YIELD $-.name, $^.player.name, $$.player.name"; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$-.name"}, {"$^.player.name"}, {"$$.player.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<uniform_tuple_t<std::string, 3>> expected = { {"Tim Duncan", "Manu Ginobili", "Tim Duncan"}, {"Tim Duncan", "Tony Parker", "LaMarcus Aldridge"}, {"Tim Duncan", "Tony Parker", "Manu Ginobili"}, {"Tim Duncan", "Tony Parker", "Tim Duncan"}, {"Chris Paul", "LeBron James", "Ray Allen"}, {"Chris Paul", "Carmelo Anthony", "Chris Paul"}, {"Chris Paul", "Carmelo Anthony", "LeBron James"}, {"Chris Paul", "Carmelo Anthony", "Dwyane Wade"}, {"Chris Paul", "Dwyane Wade", "Chris Paul"}, {"Chris Paul", "Dwyane Wade", "LeBron James"}, {"Chris Paul", "Dwyane Wade", "Carmelo Anthony"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; std::string query = "GO FROM hash('Tim Duncan'),hash('Chris Paul') OVER like " "YIELD $^.player.name AS name, like._dst AS id " "| GO FROM $-.id OVER like " "WHERE $-.name != $$.player.name " "YIELD $-.name, $^.player.name, $$.player.name"; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$-.name"}, {"$^.player.name"}, {"$$.player.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<uniform_tuple_t<std::string, 3>> expected = { {"Tim Duncan", "Tony Parker", "LaMarcus Aldridge"}, {"Tim Duncan", "Tony Parker", "Manu Ginobili"}, {"Chris Paul", "LeBron James", "Ray Allen"}, {"Chris Paul", "Carmelo Anthony", "LeBron James"}, {"Chris Paul", "Carmelo Anthony", "Dwyane Wade"}, {"Chris Paul", "Dwyane Wade", "LeBron James"}, {"Chris Paul", "Dwyane Wade", "Carmelo Anthony"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; std::string query = "GO FROM hash('Tim Duncan'),hash('Chris Paul') OVER like " "YIELD $^.player.name AS name, like._dst AS id " "| GO FROM $-.id OVER like " "YIELD $-.*, $^.player.name, $$.player.name"; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); auto &manu = players_["Manu Ginobili"]; auto &tony = players_["Tony Parker"]; auto &lebron = players_["LeBron James"]; auto &melo = players_["Carmelo Anthony"]; auto &wade = players_["Dwyane Wade"]; std::vector<std::tuple<std::string, uint64_t, std::string, std::string>> expected = { {"Tim Duncan", manu.vid(), "Manu Ginobili", "Tim Duncan"}, {"Tim Duncan", tony.vid(), "Tony Parker", "LaMarcus Aldridge"}, {"Tim Duncan", tony.vid(), "Tony Parker", "Manu Ginobili"}, {"Tim Duncan", tony.vid(), "Tony Parker", "Tim Duncan"}, {"Chris Paul", lebron.vid(), "LeBron James", "Ray Allen"}, {"Chris Paul", melo.vid(), "Carmelo Anthony", "Chris Paul"}, {"Chris Paul", melo.vid(), "Carmelo Anthony", "LeBron James"}, {"Chris Paul", melo.vid(), "Carmelo Anthony", "Dwyane Wade"}, {"Chris Paul", wade.vid(), "Dwyane Wade", "Chris Paul"}, {"Chris Paul", wade.vid(), "Dwyane Wade", "LeBron James"}, {"Chris Paul", wade.vid(), "Dwyane Wade", "Carmelo Anthony"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, ReferenceVariableInYieldAndWhere) { { cpp2::ExecutionResponse resp; std::string query = "$var = GO FROM hash('Tim Duncan'),hash('Chris Paul') OVER like " "YIELD $^.player.name AS name, like._dst AS id; " "GO FROM $var.id OVER like " "YIELD $var.name, $^.player.name, $$.player.name"; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$var.name"}, {"$^.player.name"}, {"$$.player.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<uniform_tuple_t<std::string, 3>> expected = { {"Tim Duncan", "Manu Ginobili", "Tim Duncan"}, {"Tim Duncan", "Tony Parker", "LaMarcus Aldridge"}, {"Tim Duncan", "Tony Parker", "Manu Ginobili"}, {"Tim Duncan", "Tony Parker", "Tim Duncan"}, {"Chris Paul", "LeBron James", "Ray Allen"}, {"Chris Paul", "Carmelo Anthony", "Chris Paul"}, {"Chris Paul", "Carmelo Anthony", "LeBron James"}, {"Chris Paul", "Carmelo Anthony", "Dwyane Wade"}, {"Chris Paul", "Dwyane Wade", "Chris Paul"}, {"Chris Paul", "Dwyane Wade", "LeBron James"}, {"Chris Paul", "Dwyane Wade", "Carmelo Anthony"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; std::string query = "$var = GO FROM hash('Tim Duncan'),hash('Chris Paul') OVER like " "YIELD $^.player.name AS name, like._dst AS id; " "GO FROM $var.id OVER like " "WHERE $var.name != $$.player.name " "YIELD $var.name, $^.player.name, $$.player.name"; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$var.name"}, {"$^.player.name"}, {"$$.player.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<uniform_tuple_t<std::string, 3>> expected = { {"Tim Duncan", "Tony Parker", "LaMarcus Aldridge"}, {"Tim Duncan", "Tony Parker", "Manu Ginobili"}, {"Chris Paul", "LeBron James", "Ray Allen"}, {"Chris Paul", "Carmelo Anthony", "LeBron James"}, {"Chris Paul", "Carmelo Anthony", "Dwyane Wade"}, {"Chris Paul", "Dwyane Wade", "LeBron James"}, {"Chris Paul", "Dwyane Wade", "Carmelo Anthony"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; std::string query = "$var = GO FROM hash('Tim Duncan'),hash('Chris Paul') OVER like " "YIELD $^.player.name AS name, like._dst AS id; " "GO FROM $var.id OVER like " "YIELD $var.*, $^.player.name, $$.player.name"; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); auto &manu = players_["Manu Ginobili"]; auto &tony = players_["Tony Parker"]; auto &lebron = players_["LeBron James"]; auto &melo = players_["Carmelo Anthony"]; auto &wade = players_["Dwyane Wade"]; std::vector<std::tuple<std::string, uint64_t, std::string, std::string>> expected = { {"Tim Duncan", manu.vid(), "Manu Ginobili", "Tim Duncan"}, {"Tim Duncan", tony.vid(), "Tony Parker", "LaMarcus Aldridge"}, {"Tim Duncan", tony.vid(), "Tony Parker", "Manu Ginobili"}, {"Tim Duncan", tony.vid(), "Tony Parker", "Tim Duncan"}, {"Chris Paul", lebron.vid(), "LeBron James", "Ray Allen"}, {"Chris Paul", melo.vid(), "Carmelo Anthony", "Chris Paul"}, {"Chris Paul", melo.vid(), "Carmelo Anthony", "LeBron James"}, {"Chris Paul", melo.vid(), "Carmelo Anthony", "Dwyane Wade"}, {"Chris Paul", wade.vid(), "Dwyane Wade", "Chris Paul"}, {"Chris Paul", wade.vid(), "Dwyane Wade", "LeBron James"}, {"Chris Paul", wade.vid(), "Dwyane Wade", "Carmelo Anthony"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, NonexistentProp) { { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve YIELD $^.player.test"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve yield $^.player.test"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve YIELD serve.test"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); } } TEST_P(GoTest, is_inCall) { { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE udf_is_in($$.team.name, \"Hawks\", \"Suns\") " "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code) << *resp.get_error_msg(); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2003, 2005, "Hawks"}, {player.name(), 2005, 2008, "Suns"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._dst AS id" "| GO FROM $-.id OVER serve WHERE udf_is_in($-.id, %ld, 123)"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Hornets"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._dst AS id" "| GO FROM $-.id OVER serve WHERE udf_is_in($-.id, %ld, 123) && 1 == 1"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Hornets"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, ReturnTest) { { cpp2::ExecutionResponse resp; auto *fmt = "$A = GO FROM %ld OVER like YIELD like._dst AS dst;" /* 1st hop */ "$rA = YIELD $A.* WHERE $A.dst == 123;" "RETURN $rA IF $rA IS NOT NULL;" /* will not return */ "GO FROM $A.dst OVER serve"; /* 2nd hop */ auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Hornets"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "$A = GO FROM %ld OVER like YIELD like._dst AS dst;" /* 1st hop */ "$rA = YIELD $A.* WHERE 1 == 1;" "RETURN $rA IF $rA IS NOT NULL;" /* will return */ "GO FROM $A.dst OVER serve"; /* 2nd hop */ auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$A.dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "$A = GO FROM %ld OVER like YIELD like._dst AS dstA;" /* 1st hop */ "$rA = YIELD $A.* WHERE $A.dstA == 123;" "RETURN $rA IF $rA IS NOT NULL;" /* will not return */ "$B = GO FROM $A.dstA OVER like YIELD like._dst AS dstB;" /* 2nd hop */ "$rB = YIELD $B.* WHERE $B.dstB == 456;" "RETURN $rB IF $rB IS NOT NULL;" /* will not return */ "GO FROM $B.dstB OVER serve"; /* 3rd hop */ auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, {teams_["Trail Blazers"].vid()}, {teams_["Spurs"].vid()}, {teams_["Spurs"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "$A = GO FROM %ld OVER like YIELD like._dst AS dst;" /* 1st hop */ "$rA = YIELD $A.* WHERE $A.dst == 123;" "RETURN $rA IF $rA IS NOT NULL;"; /* will return nothing */ auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_EQ(nullptr, resp.get_rows()); } { cpp2::ExecutionResponse resp; auto *fmt = "$A = GO FROM %ld OVER like YIELD like._dst AS dst;" /* 1st hop */ "$rA = YIELD $A.* WHERE 1 == 1;" "RETURN $rA IF $rA IS NOT NULL;"; /* will return */ auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$A.dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "$A = GO FROM %ld OVER like YIELD like._dst AS dst;" /* 1st hop */ "$rA = YIELD $A.* WHERE 1 == 1;" "RETURN $B IF $B IS NOT NULL;"; /* will return error */ auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); } { cpp2::ExecutionResponse resp; auto *fmt = "$A = GO FROM %ld OVER like YIELD like._dst AS dst;" /* 1st hop */ "$rA = YIELD $A.* WHERE 1 == 1;" "RETURN $B IF $A IS NOT NULL;"; /* will return error */ auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::E_SYNTAX_ERROR, code); } { cpp2::ExecutionResponse resp; std::string query = "RETURN $rA IF $rA IS NOT NULL;"; /* will return error */ auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); } } TEST_P(GoTest, ReverselyOneStep) { { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('Tim Duncan') OVER like REVERSELY " "YIELD like._dst"; client_->execute(query, resp); std::vector<std::tuple<int64_t>> expected = { { players_["Tony Parker"].vid() }, { players_["Manu Ginobili"].vid() }, { players_["LaMarcus Aldridge"].vid() }, { players_["Marco Belinelli"].vid() }, { players_["Danny Green"].vid() }, { players_["Aron Baynes"].vid() }, { players_["Boris Diaw"].vid() }, { players_["Tiago Splitter"].vid() }, { players_["Dejounte Murray"].vid() }, { players_["Shaquile O'Neal"].vid() }, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('Tim Duncan') OVER * REVERSELY " "YIELD like._dst"; client_->execute(query, resp); std::vector<std::tuple<int64_t>> expected = { { players_["Tony Parker"].vid() }, { players_["Manu Ginobili"].vid() }, { players_["LaMarcus Aldridge"].vid() }, { players_["Marco Belinelli"].vid() }, { players_["Danny Green"].vid() }, { players_["Aron Baynes"].vid() }, { players_["Boris Diaw"].vid() }, { players_["Tiago Splitter"].vid() }, { players_["Dejounte Murray"].vid() }, { players_["Shaquile O'Neal"].vid() }, { 0 }, { 0 }, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('Tim Duncan') OVER like REVERSELY " "YIELD $$.player.name"; client_->execute(query, resp); std::vector<std::tuple<std::string>> expected = { { "Tony Parker" }, { "Manu Ginobili" }, { "LaMarcus Aldridge" }, { "Marco Belinelli" }, { "Danny Green" }, { "Aron Baynes" }, { "Boris Diaw" }, { "Tiago Splitter" }, { "Dejounte Murray" }, { "Shaquile O'Neal" }, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('Tim Duncan') OVER like REVERSELY " "WHERE $$.player.age < 35 " "YIELD $$.player.name"; client_->execute(query, resp); std::vector<std::tuple<std::string>> expected = { { "LaMarcus Aldridge" }, { "Marco Belinelli" }, { "Danny Green" }, { "Aron Baynes" }, { "Tiago Splitter" }, { "Dejounte Murray" }, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, OnlyIdTwoSteps) { { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 2 STEPS FROM %ld OVER like YIELD like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); client_->execute(query, resp); std::vector<std::tuple<VertexID>> expected = { {3394245602834314645}, {-7579316172763586624}, {-7579316172763586624}, {5662213458193308137}, {5662213458193308137} }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, ReverselyTwoStep) { { cpp2::ExecutionResponse resp; auto query = "GO 2 STEPS FROM hash('Kobe Bryant') OVER like REVERSELY " "YIELD $$.player.name"; client_->execute(query, resp); std::vector<std::tuple<std::string>> expected = { { "Marc Gasol" }, { "Vince Carter" }, { "Yao Ming" }, { "Grant Hill" }, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto query = "GO 2 STEPS FROM hash('Kobe Bryant') OVER * REVERSELY " "YIELD $$.player.name"; client_->execute(query, resp); std::vector<std::tuple<std::string>> expected = { { "Marc Gasol" }, { "Vince Carter" }, { "Yao Ming" }, { "Grant Hill" }, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, ReverselyWithPipe) { { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('LeBron James') OVER serve YIELD serve._dst AS id |" "GO FROM $-.id OVER serve REVERSELY YIELD $^.team.name, $$.player.name"; client_->execute(query, resp); std::vector<std::tuple<std::string, std::string>> expected = { { "Cavaliers", "Kyrie Irving" }, { "Cavaliers", "Kyrie Irving" }, { "Cavaliers", "Dwyane Wade" }, { "Cavaliers", "Dwyane Wade" }, { "Cavaliers", "Shaquile O'Neal" }, { "Cavaliers", "Shaquile O'Neal" }, { "Cavaliers", "Danny Green" }, { "Cavaliers", "Danny Green" }, { "Cavaliers", "LeBron James" }, { "Cavaliers", "LeBron James" }, { "Cavaliers", "LeBron James" }, { "Cavaliers", "LeBron James" }, { "Heat", "Dwyane Wade" }, { "Heat", "Dwyane Wade" }, { "Heat", "LeBron James" }, { "Heat", "Ray Allen" }, { "Heat", "Shaquile O'Neal" }, { "Heat", "Amar'e Stoudemire" }, { "Lakers", "Kobe Bryant" }, { "Lakers", "LeBron James" }, { "Lakers", "Rajon Rondo" }, { "Lakers", "Steve Nash" }, { "Lakers", "Paul Gasol" }, { "Lakers", "Shaquile O'Neal" }, { "Lakers", "JaVale McGee" }, { "Lakers", "Dwight Howard" }, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('LeBron James') OVER serve " "YIELD serve._dst AS id |" "GO FROM $-.id OVER serve REVERSELY " "WHERE $$.player.name != 'LeBron James' " "YIELD $^.team.name, $$.player.name"; client_->execute(query, resp); std::vector<std::tuple<std::string, std::string>> expected = { { "Cavaliers", "Kyrie Irving" }, { "Cavaliers", "Dwyane Wade" }, { "Cavaliers", "Shaquile O'Neal" }, { "Cavaliers", "Danny Green" }, { "Cavaliers", "Kyrie Irving" }, { "Cavaliers", "Dwyane Wade" }, { "Cavaliers", "Shaquile O'Neal" }, { "Cavaliers", "Danny Green" }, { "Heat", "Dwyane Wade" }, { "Heat", "Dwyane Wade" }, { "Heat", "Ray Allen" }, { "Heat", "Shaquile O'Neal" }, { "Heat", "Amar'e Stoudemire" }, { "Lakers", "Kobe Bryant" }, { "Lakers", "Rajon Rondo" }, { "Lakers", "Steve Nash" }, { "Lakers", "Paul Gasol" }, { "Lakers", "Shaquile O'Neal" }, { "Lakers", "JaVale McGee" }, { "Lakers", "Dwight Howard" }, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('Manu Ginobili') OVER like REVERSELY " "YIELD like._dst AS id |" "GO FROM $-.id OVER serve"; client_->execute(query, resp); std::vector<std::tuple<int64_t>> expected = { { teams_["Spurs"].vid() }, { teams_["Spurs"].vid() }, { teams_["Hornets"].vid() }, { teams_["Spurs"].vid() }, { teams_["Hawks"].vid() }, { teams_["76ers"].vid() }, { teams_["Spurs"].vid() }, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('Manu Ginobili') OVER * REVERSELY " "YIELD like._dst AS id |" "GO FROM $-.id OVER serve"; client_->execute(query, resp); std::vector<std::tuple<int64_t>> expected = { { teams_["Spurs"].vid() }, { teams_["Spurs"].vid() }, { teams_["Hornets"].vid() }, { teams_["Spurs"].vid() }, { teams_["Hawks"].vid() }, { teams_["76ers"].vid() }, { teams_["Spurs"].vid() }, }; ASSERT_TRUE(verifyResult(resp, expected)); } /** * TODO(dutor) * For the time being, reference to the pipe inputs is faulty. * Because there might be multiple associated records with the same column value, * which is used as the source id by the right statement. * * So the following case is disabled temporarily. */ /* { cpp2::ExecutionResponse resp; auto query = "GO FROM hash('LeBron James') OVER serve " "YIELD serve._dst AS id, serve.start_year AS start, " "serve.end_year AS end |" "GO FROM $-.id OVER serve REVERSELY " "WHERE $$.player.name != 'LeBron James' && " "serve.start_year <= $-.end && serve.end_year >= $-.end " "YIELD $^.team.name, $$.player.name"; client_->execute(query, resp); std::vector<std::tuple<std::string, std::string>> expected = { { "Cavaliers", "Kyrie Irving" }, { "Cavaliers", "Shaquile O'Neal" }, { "Cavaliers", "Danny Green" }, { "Cavaliers", "Dwyane Wade" }, { "Heat", "Dwyane Wade" }, { "Heat", "Ray Allen" }, { "Lakers", "Rajon Rondo" }, { "Lakers", "JaVale McGee" }, }; ASSERT_TRUE(verifyResult(resp, expected)); } */ } TEST_P(GoTest, Bidirect) { { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve bidirect"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like bidirect"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"like._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Marco Belinelli"].vid()}, {players_["Danny Green"].vid()}, {players_["Aron Baynes"].vid()}, {players_["Boris Diaw"].vid()}, {players_["Tiago Splitter"].vid()}, {players_["Dejounte Murray"].vid()}, {players_["Shaquile O'Neal"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve, like bidirect"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"}, {"like._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Spurs"].vid(), 0}, {0, players_["Tony Parker"].vid()}, {0, players_["Manu Ginobili"].vid()}, {0, players_["Tony Parker"].vid()}, {0, players_["Manu Ginobili"].vid()}, {0, players_["LaMarcus Aldridge"].vid()}, {0, players_["Marco Belinelli"].vid()}, {0, players_["Danny Green"].vid()}, {0, players_["Aron Baynes"].vid()}, {0, players_["Boris Diaw"].vid()}, {0, players_["Tiago Splitter"].vid()}, {0, players_["Dejounte Murray"].vid()}, {0, players_["Shaquile O'Neal"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * bidirect"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"}, {"like._dst"}, {"teammate._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t, int64_t, int64_t>> expected = { {teams_["Spurs"].vid(), 0, 0}, {0, players_["Tony Parker"].vid(), 0}, {0, players_["Manu Ginobili"].vid(), 0}, {0, players_["Tony Parker"].vid(), 0}, {0, players_["Manu Ginobili"].vid(), 0}, {0, players_["LaMarcus Aldridge"].vid(), 0}, {0, players_["Marco Belinelli"].vid(), 0}, {0, players_["Danny Green"].vid(), 0}, {0, players_["Aron Baynes"].vid(), 0}, {0, players_["Boris Diaw"].vid(), 0}, {0, players_["Tiago Splitter"].vid(), 0}, {0, players_["Dejounte Murray"].vid(), 0}, {0, players_["Shaquile O'Neal"].vid(), 0}, {0, 0, players_["Tony Parker"].vid()}, {0, 0, players_["Manu Ginobili"].vid()}, {0, 0, players_["LaMarcus Aldridge"].vid()}, {0, 0, players_["Danny Green"].vid()}, {0, 0, players_["Tony Parker"].vid()}, {0, 0, players_["Manu Ginobili"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve bidirect YIELD $$.team.name"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string>> expected = { {"Spurs"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like bidirect YIELD $$.player.name"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$$.player.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string>> expected = { {"Tony Parker"}, {"Manu Ginobili"}, {"Tony Parker"}, {"Manu Ginobili"}, {"LaMarcus Aldridge"}, {"Marco Belinelli"}, {"Danny Green"}, {"Aron Baynes"}, {"Boris Diaw"}, {"Tiago Splitter"}, {"Dejounte Murray"}, {"Shaquile O'Neal"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like bidirect " "WHERE like.likeness > 90 " "YIELD $^.player.name, like._dst, $$.player.name, like.likeness"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name", "like._dst", "$$.player.name", "like.likeness"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, std::string, int64_t>> expected = { {"Tim Duncan", players_["Tony Parker"].vid(), "Tony Parker", 95}, {"Tim Duncan", players_["Manu Ginobili"].vid(), "Manu Ginobili", 95}, {"Tim Duncan", players_["Tony Parker"].vid(), "Tony Parker", 95}, {"Tim Duncan", players_["Dejounte Murray"].vid(), "Dejounte Murray", 99}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER * bidirect " "YIELD $^.player.name, serve._dst, $$.team.name, like._dst, $$.player.name"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve._dst"}, {"$$.team.name"}, {"like._dst"}, {"$$.player.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector< std::tuple<std::string, int64_t, std::string, int64_t, std::string> > expected = { {"Tim Duncan", teams_["Spurs"].vid(), "Spurs", 0, ""}, {"Tim Duncan", 0, "", players_["Tony Parker"].vid(), "Tony Parker"}, {"Tim Duncan", 0, "", players_["Manu Ginobili"].vid(), "Manu Ginobili"}, {"Tim Duncan", 0, "", players_["Tony Parker"].vid(), "Tony Parker"}, {"Tim Duncan", 0, "", players_["Manu Ginobili"].vid(), "Manu Ginobili"}, {"Tim Duncan", 0, "", players_["LaMarcus Aldridge"].vid(), "LaMarcus Aldridge"}, {"Tim Duncan", 0, "", players_["Marco Belinelli"].vid(), "Marco Belinelli"}, {"Tim Duncan", 0, "", players_["Danny Green"].vid(), "Danny Green"}, {"Tim Duncan", 0, "", players_["Aron Baynes"].vid(), "Aron Baynes"}, {"Tim Duncan", 0, "", players_["Boris Diaw"].vid(), "Boris Diaw"}, {"Tim Duncan", 0, "", players_["Tiago Splitter"].vid(), "Tiago Splitter"}, {"Tim Duncan", 0, "", players_["Dejounte Murray"].vid(), "Dejounte Murray"}, {"Tim Duncan", 0, "", players_["Shaquile O'Neal"].vid(), "Shaquile O'Neal"}, // These response derives from the teamates, the fifth column has property // because that we collect props with column name. {"Tim Duncan", 0, "", 0, "Tony Parker"}, {"Tim Duncan", 0, "", 0, "Manu Ginobili"}, {"Tim Duncan", 0, "", 0, "Danny Green"}, {"Tim Duncan", 0, "", 0, "LaMarcus Aldridge"}, {"Tim Duncan", 0, "", 0, "Tony Parker"}, {"Tim Duncan", 0, "", 0, "Manu Ginobili"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, FilterPushdown) { #define TEST_FILTER_PUSHDOWN_REWRITE(can_pushdown, filter_pushdown) \ auto result = GQLParser().parse(query); \ ASSERT_TRUE(result.ok()); \ auto sentences = result.value()->sentences(); \ ASSERT_EQ(sentences.size(), 1); \ auto goSentence = static_cast<GoSentence *>(sentences[0]); \ auto whereWrapper = std::make_unique<WhereWrapper>(goSentence->whereClause()); \ auto filter = whereWrapper->filter_; \ ASSERT_NE(filter, nullptr); \ auto isRewriteSucceded = whereWrapper->rewrite(filter); \ auto canPushdown = isRewriteSucceded && whereWrapper->canPushdown(filter); \ ASSERT_EQ(can_pushdown, canPushdown); \ std::string filterPushdown = ""; \ if (canPushdown) { \ filterPushdown = filter->toString(); \ } \ LOG(INFO) << "Filter rewrite: " << filterPushdown; \ ASSERT_EQ(filter_pushdown, filterPushdown); { // Filter pushdown: ((serve.start_year>2013)&&(serve.end_year<2018)) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "((serve.start_year>2013)&&(serve.end_year<2018))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: !((serve.start_year>2013)&&(serve.end_year<2018)) auto *fmt = "GO FROM %ld OVER serve " "WHERE !(serve.start_year > 2013 && serve.end_year < 2018)"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "!(((serve.start_year>2013)&&(serve.end_year<2018)))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Celtics"].vid()}, {teams_["Pelicans"].vid()}, {teams_["Lakers"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: ((serve.start_year>2013)&&true) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013 && $$.team.name == \"Kings\""; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "((serve.start_year>2013)&&true)"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Kings"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // will not pushdown auto *fmt = "GO FROM %ld OVER serve " "WHERE $$.team.name == \"Celtics\" && $$.team.name == \"Kings\""; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: ((serve.start_year>2013)&&true) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013" " && (serve.end_year < 2018 || $$.team.name == \"Kings\")"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "((serve.start_year>2013)&&true)"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: (true&&(serve.start_year>2013)) auto *fmt = "GO FROM %ld OVER serve " "WHERE (serve.end_year < 2018 || $$.team.name == \"Kings\")" "&& serve.start_year > 2013"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "(true&&(serve.start_year>2013))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // will not push down auto *fmt = "GO FROM %ld OVER serve " "WHERE $$.team.name == \"Celtics\" || $$.team.name == \"Kings\""; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Celtics"].vid()}, {teams_["Kings"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: (((serve.start_year>2013)&&(serve.end_year<2018))&&true) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013 && serve.end_year < 2018" " && $$.team.name == \"Kings\""; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "(((serve.start_year>2013)&&(serve.end_year<2018))&&true)"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Kings"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: (((serve.start_year>2013)&&true)&&(serve.end_year<2018)) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013" " && $$.team.name == \"Kings\"" " && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "(((serve.start_year>2013)&&true)&&(serve.end_year<2018))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Kings"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: ((true&&(serve.start_year>2013))&&(serve.end_year<2018)) auto *fmt = "GO FROM %ld OVER serve " "WHERE $$.team.name == \"Kings\"" " && serve.start_year > 2013" " && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "((true&&(serve.start_year>2013))&&(serve.end_year<2018))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Kings"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // ((serve.start_year==2013)||((serve.start_year>2013)&&(serve.end_year<2018))) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year == 2013" " OR serve.start_year > 2013 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "((serve.start_year==2013)||((serve.start_year>2013)&&(serve.end_year<2018)))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // (((serve.start_year>2013)&&(serve.end_year<=2015)) // || ((serve.start_year>=2015)&&(serve.end_year<2018))) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013 && serve.end_year <= 2015" " OR serve.start_year >= 2015 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "(((serve.start_year>2013)&&(serve.end_year<=2015))" "||((serve.start_year>=2015)&&(serve.end_year<2018)))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // ((((serve.start_year>2013)&&(serve.end_year<=2015))&&true) // ||((serve.start_year>=2015)&&(serve.end_year<2018))) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013 && serve.end_year <= 2015" " && $$.team.name == \"Mavericks\"" " OR serve.start_year >= 2015 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "((((serve.start_year>2013)&&(serve.end_year<=2015))&&true)" "||((serve.start_year>=2015)&&(serve.end_year<2018)))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // will not push down the filter auto *fmt = "GO FROM %ld OVER serve " "WHERE $$.team.name == \"Pelicans\"" " OR serve.start_year > 2013 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, {teams_["Pelicans"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // will not push down the filter auto *fmt = "GO FROM %ld OVER serve " "WHERE $$.team.name == \"Pelicans\"" " OR serve.start_year > 2013 && serve.end_year <= 2015" " OR serve.start_year >= 2015 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, {teams_["Pelicans"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // (((serve.start_year>2013)&&(serve.end_year<=2015)) // XOR((serve.start_year>=2015)&&(serve.end_year<2018))) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013 && serve.end_year <= 2015" " XOR serve.start_year >= 2015 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "(((serve.start_year>2013)&&(serve.end_year<=2015))" "XOR((serve.start_year>=2015)&&(serve.end_year<2018)))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // will not pushdown auto *fmt = "GO FROM %ld OVER serve " "WHERE serve.start_year > 2013 && serve.end_year <= 2015" " && $$.team.name == \"Mavericks\"" " XOR serve.start_year >= 2015 && serve.end_year < 2018"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Mavericks"].vid()}, {teams_["Kings"].vid()}, {teams_["Bulls"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: (($^.player.name=="Tony Parker")&&(serve.start_year>2013)) auto query = "GO FROM $-.id OVER serve " "WHERE $^.player.name == \"Tony Parker\" && serve.start_year > 2013"; TEST_FILTER_PUSHDOWN_REWRITE( true, "(($^.player.name==Tony Parker)&&(serve.start_year>2013))"); auto *fmt = "GO FROM %ld OVER like YIELD like._dst AS id | "; auto newQuery = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()).append(query); cpp2::ExecutionResponse resp; auto code = client_->execute(newQuery, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Hornets"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { // Filter pushdown: // (((serve._src==5662213458193308137)&&(serve._rank==0))&&(serve._dst==7193291116733635180)) auto *fmt = "GO FROM %ld OVER serve " "WHERE serve._src == %ld && serve._rank == 0 && serve._dst == %ld" "YIELD serve._dst AS id"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), teams_["Spurs"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "(((serve._src==5662213458193308137)&&(serve._rank==0))" "&&(serve._dst==7193291116733635180))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"id"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { auto *fmt = "GO FROM %ld OVER serve " "WHERE udf_is_in(serve._dst, 1, 2, 3)"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "udf_is_in(serve._dst,1,2,3)"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code) << *(resp.get_error_msg()); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected; ASSERT_TRUE(verifyResult(resp, expected)); } { auto *fmt = "GO FROM %ld OVER serve " "WHERE udf_is_in(serve._dst, %ld, 2, 3)"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid(), teams_["Celtics"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, folly::stringPrintf("udf_is_in(serve._dst,%ld,2,3)", teams_["Celtics"].vid())); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code) << *(resp.get_error_msg()); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Celtics"].vid()} }; ASSERT_TRUE(verifyResult(resp, expected)); } { auto *fmt = "GO FROM %ld OVER serve " "WHERE udf_is_in(\"test\", $$.team.name)"; auto query = folly::stringPrintf(fmt, players_["Rajon Rondo"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code) << *(resp.get_error_msg()); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected; ASSERT_TRUE(verifyResult(resp, expected)); } { auto *fmt = "GO FROM %ld OVER serve " "WHERE udf_is_in($^.player.name, \"Tim Duncan\")"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "udf_is_in($^.player.name,Tim Duncan)"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code) << *(resp.get_error_msg()); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected = { {teams_["Spurs"].vid()} }; ASSERT_TRUE(verifyResult(resp, expected)); } { auto *fmt = "GO FROM %ld OVER serve " "WHERE !udf_is_in($^.player.name, \"Tim Duncan\")"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "!(udf_is_in($^.player.name,Tim Duncan))"); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code) << *(resp.get_error_msg()); std::vector<std::string> expectedColNames{ {"serve._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t>> expected; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE $$.team.name CONTAINS Haw " "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2003, 2005, "Hawks"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE (string)serve.start_year CONTAINS \"05\" " "&& $^.player.name CONTAINS \"Boris\"" "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); TEST_FILTER_PUSHDOWN_REWRITE( true, "(((string)serve.start_year CONTAINS 05)&&($^.player.name CONTAINS Boris))"); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2005, 2008, "Suns"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { auto *fmt = "GO FROM %ld OVER serve, like " "WHERE serve.start_year > 2013 OR like.likeness > 90"; auto query = folly::stringPrintf(fmt, players_["Tony Parker"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"}, {"like._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Hornets"].vid(), 0}, {0, players_["Tim Duncan"].vid()}, {0, players_["Manu Ginobili"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { auto *fmt = "GO FROM %ld OVER serve, like " "WHERE !(serve.start_year > 2013 OR like.likeness > 90)"; auto query = folly::stringPrintf(fmt, players_["Tony Parker"].vid()); TEST_FILTER_PUSHDOWN_REWRITE( false, ""); cpp2::ExecutionResponse resp; auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"}, {"like._dst"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Spurs"].vid(), 0}, {0, players_["LaMarcus Aldridge"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } #undef TEST_FILTER_PUSHDWON_REWRITE } TEST_P(GoTest, DuplicateColumnName) { { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve YIELD serve._dst, serve._dst"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"serve._dst"}, {"serve._dst"}, }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Spurs"].vid(), teams_["Spurs"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._dst AS id, like.likeness AS id" " | GO FROM $-.id OVER serve"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); } } TEST_P(GoTest, Contains) { { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE $$.team.name CONTAINS Haw " "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2003, 2005, "Hawks"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE (string)serve.start_year CONTAINS \"05\" " "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2005, 2008, "Suns"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE $^.player.name CONTAINS \"Boris\" " "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::string> expectedColNames{ {"$^.player.name"}, {"serve.start_year"}, {"serve.end_year"}, {"$$.team.name"} }; ASSERT_TRUE(verifyColNames(resp, expectedColNames)); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { {player.name(), 2003, 2005, "Hawks"}, {player.name(), 2005, 2008, "Suns"}, {player.name(), 2008, 2012, "Hornets"}, {player.name(), 2012, 2016, "Spurs"}, {player.name(), 2016, 2017, "Jazz"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE !($^.player.name CONTAINS \"Boris\") " "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Boris Diaw"]; auto *fmt = "GO FROM %ld OVER serve " "WHERE \"Leo\" CONTAINS \"Boris\" " "YIELD $^.player.name, serve.start_year, serve.end_year, $$.team.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<std::string, int64_t, int64_t, std::string>> expected = { }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, WithIntermediateData) { // zero to zero { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 0 TO 0 STEPS FROM %ld OVER like YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { }; ASSERT_TRUE(verifyResult(resp, expected)); } // simple { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 1 TO 2 STEPS FROM %ld OVER like YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Tim Duncan"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 0 TO 2 STEPS FROM %ld OVER like YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Tim Duncan"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // With properties { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 1 TO 2 STEPS FROM %ld OVER like " "YIELD DISTINCT like._dst, like.likeness, $$.player.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID, int64_t, std::string>> expected = { {players_["Manu Ginobili"].vid(), 95, "Manu Ginobili"}, {players_["LaMarcus Aldridge"].vid(), 90, "LaMarcus Aldridge"}, {players_["Tim Duncan"].vid(), 95, "Tim Duncan"}, {players_["Tony Parker"].vid(), 95, "Tony Parker"}, {players_["Tony Parker"].vid(), 75, "Tony Parker"}, {players_["Tim Duncan"].vid(), 75, "Tim Duncan"}, {players_["Tim Duncan"].vid(), 90, "Tim Duncan"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 0 TO 2 STEPS FROM %ld OVER like " "YIELD DISTINCT like._dst, like.likeness, $$.player.name"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID, int64_t, std::string>> expected = { {players_["Manu Ginobili"].vid(), 95, "Manu Ginobili"}, {players_["LaMarcus Aldridge"].vid(), 90, "LaMarcus Aldridge"}, {players_["Tim Duncan"].vid(), 95, "Tim Duncan"}, {players_["Tony Parker"].vid(), 95, "Tony Parker"}, {players_["Tony Parker"].vid(), 75, "Tony Parker"}, {players_["Tim Duncan"].vid(), 75, "Tim Duncan"}, {players_["Tim Duncan"].vid(), 90, "Tim Duncan"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // empty starts before last step { cpp2::ExecutionResponse resp; auto *fmt = "GO 1 TO 3 STEPS FROM %ld OVER serve"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { teams_["Spurs"].vid() }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO 0 TO 3 STEPS FROM %ld OVER serve"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { teams_["Spurs"].vid() }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO 2 TO 3 STEPS FROM %ld OVER serve"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { }; ASSERT_TRUE(verifyResult(resp, expected)); } // reversely { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 1 TO 2 STEPS FROM %ld OVER like REVERSELY YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {players_["Tim Duncan"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Marco Belinelli"].vid()}, {players_["Boris Diaw"].vid()}, {players_["Dejounte Murray"].vid()}, {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Danny Green"].vid()}, {players_["Aron Baynes"].vid()}, {players_["Tiago Splitter"].vid()}, {players_["Shaquile O'Neal"].vid()}, {players_["Rudy Gay"].vid()}, {players_["Damian Lillard"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 0 TO 2 STEPS FROM %ld OVER like REVERSELY YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {players_["Tim Duncan"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Marco Belinelli"].vid()}, {players_["Boris Diaw"].vid()}, {players_["Dejounte Murray"].vid()}, {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Danny Green"].vid()}, {players_["Aron Baynes"].vid()}, {players_["Tiago Splitter"].vid()}, {players_["Shaquile O'Neal"].vid()}, {players_["Rudy Gay"].vid()}, {players_["Damian Lillard"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 2 TO 2 STEPS FROM %ld OVER like REVERSELY YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {players_["LaMarcus Aldridge"].vid()}, {players_["Marco Belinelli"].vid()}, {players_["Boris Diaw"].vid()}, {players_["Dejounte Murray"].vid()}, {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Danny Green"].vid()}, {players_["Aron Baynes"].vid()}, {players_["Tiago Splitter"].vid()}, {players_["Shaquile O'Neal"].vid()}, {players_["Rudy Gay"].vid()}, {players_["Damian Lillard"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // empty starts before last step { cpp2::ExecutionResponse resp; auto *fmt = "GO 1 TO 3 STEPS FROM %ld OVER serve REVERSELY"; auto query = folly::stringPrintf(fmt, teams_["Spurs"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Rudy Gay"].vid(), players_["Marco Belinelli"].vid(), players_["Danny Green"].vid(), players_["Kyle Anderson"].vid(), players_["Aron Baynes"].vid(), players_["Boris Diaw"].vid(), players_["Tiago Splitter"].vid(), players_["Cory Joseph"].vid(), players_["David West"].vid(), players_["Jonathon Simmons"].vid(), players_["Dejounte Murray"].vid(), players_["Tracy McGrady"].vid(), players_["Paul Gasol"].vid(), players_["Marco Belinelli"].vid(), }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO 0 TO 3 STEPS FROM %ld OVER serve REVERSELY"; auto query = folly::stringPrintf(fmt, teams_["Spurs"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Rudy Gay"].vid(), players_["Marco Belinelli"].vid(), players_["Danny Green"].vid(), players_["Kyle Anderson"].vid(), players_["Aron Baynes"].vid(), players_["Boris Diaw"].vid(), players_["Tiago Splitter"].vid(), players_["Cory Joseph"].vid(), players_["David West"].vid(), players_["Jonathon Simmons"].vid(), players_["Dejounte Murray"].vid(), players_["Tracy McGrady"].vid(), players_["Paul Gasol"].vid(), players_["Marco Belinelli"].vid(), }; ASSERT_TRUE(verifyResult(resp, expected)); } // Bidirectionally { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 1 TO 2 STEPS FROM %ld OVER like BIDIRECT YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {players_["Tim Duncan"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Marco Belinelli"].vid()}, {players_["Boris Diaw"].vid()}, {players_["Dejounte Murray"].vid()}, {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Danny Green"].vid()}, {players_["Aron Baynes"].vid()}, {players_["Tiago Splitter"].vid()}, {players_["Shaquile O'Neal"].vid()}, {players_["Rudy Gay"].vid()}, {players_["Damian Lillard"].vid()}, {players_["LeBron James"].vid()}, {players_["Russell Westbrook"].vid()}, {players_["Chris Paul"].vid()}, {players_["Kyle Anderson"].vid()}, {players_["Kevin Durant"].vid()}, {players_["James Harden"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto &player = players_["Tony Parker"]; auto *fmt = "GO 0 TO 2 STEPS FROM %ld OVER like BIDIRECT YIELD DISTINCT like._dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID>> expected = { {players_["Tim Duncan"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Marco Belinelli"].vid()}, {players_["Boris Diaw"].vid()}, {players_["Dejounte Murray"].vid()}, {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Danny Green"].vid()}, {players_["Aron Baynes"].vid()}, {players_["Tiago Splitter"].vid()}, {players_["Shaquile O'Neal"].vid()}, {players_["Rudy Gay"].vid()}, {players_["Damian Lillard"].vid()}, {players_["LeBron James"].vid()}, {players_["Russell Westbrook"].vid()}, {players_["Chris Paul"].vid()}, {players_["Kyle Anderson"].vid()}, {players_["Kevin Durant"].vid()}, {players_["James Harden"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // over * { cpp2::ExecutionResponse resp; auto *fmt = "GO 1 TO 2 STEPS FROM %ld OVER * YIELD serve._dst, like._dst"; const auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Thunders"].vid(), 0}, {0, players_["Paul George"].vid()}, {0, players_["James Harden"].vid()}, {teams_["Pacers"].vid(), 0}, {teams_["Thunders"].vid(), 0}, {0, players_["Russell Westbrook"].vid()}, {teams_["Thunders"].vid(), 0}, {teams_["Rockets"].vid(), 0}, {0, players_["Russell Westbrook"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO 0 TO 2 STEPS FROM %ld OVER * YIELD serve._dst, like._dst"; const auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {teams_["Thunders"].vid(), 0}, {0, players_["Paul George"].vid()}, {0, players_["James Harden"].vid()}, {teams_["Pacers"].vid(), 0}, {teams_["Thunders"].vid(), 0}, {0, players_["Russell Westbrook"].vid()}, {teams_["Thunders"].vid(), 0}, {teams_["Rockets"].vid(), 0}, {0, players_["Russell Westbrook"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // With properties { cpp2::ExecutionResponse resp; auto *fmt = "GO 1 TO 2 STEPS FROM %ld OVER * " "YIELD serve._dst, like._dst, serve.start_year, like.likeness, $$.player.name"; const auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, int64_t, int64_t, std::string>> expected = { {teams_["Thunders"].vid(), 0, 2008, 0, ""}, {0, players_["Paul George"].vid(), 0, 90, "Paul George"}, {0, players_["James Harden"].vid(), 0, 90, "James Harden"}, {teams_["Pacers"].vid(), 0, 2010, 0, ""}, {teams_["Thunders"].vid(), 0, 2017, 0, ""}, {0, players_["Russell Westbrook"].vid(), 0, 95, "Russell Westbrook"}, {teams_["Thunders"].vid(), 0, 2009, 0, ""}, {teams_["Rockets"].vid(), 0, 2012, 0, ""}, {0, players_["Russell Westbrook"].vid(), 0, 80, "Russell Westbrook"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO 0 TO 2 STEPS FROM %ld OVER * " "YIELD serve._dst, like._dst, serve.start_year, like.likeness, $$.player.name"; const auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, int64_t, int64_t, std::string>> expected = { {teams_["Thunders"].vid(), 0, 2008, 0, ""}, {0, players_["Paul George"].vid(), 0, 90, "Paul George"}, {0, players_["James Harden"].vid(), 0, 90, "James Harden"}, {teams_["Pacers"].vid(), 0, 2010, 0, ""}, {teams_["Thunders"].vid(), 0, 2017, 0, ""}, {0, players_["Russell Westbrook"].vid(), 0, 95, "Russell Westbrook"}, {teams_["Thunders"].vid(), 0, 2009, 0, ""}, {teams_["Rockets"].vid(), 0, 2012, 0, ""}, {0, players_["Russell Westbrook"].vid(), 0, 80, "Russell Westbrook"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO 1 TO 2 STEPS FROM %ld OVER * REVERSELY YIELD serve._dst, like._dst"; const auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {0, players_["Dejounte Murray"].vid()}, {0, players_["James Harden"].vid()}, {0, players_["Paul George"].vid()}, {0, players_["Dejounte Murray"].vid()}, {0, players_["Russell Westbrook"].vid()}, {0, players_["Luka Doncic"].vid()}, {0, players_["Russell Westbrook"].vid()}, }; } { cpp2::ExecutionResponse resp; auto *fmt = "GO 0 TO 2 STEPS FROM %ld OVER * REVERSELY YIELD serve._dst, like._dst"; const auto &player = players_["Russell Westbrook"]; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {0, players_["Dejounte Murray"].vid()}, {0, players_["James Harden"].vid()}, {0, players_["Paul George"].vid()}, {0, players_["Dejounte Murray"].vid()}, {0, players_["Russell Westbrook"].vid()}, {0, players_["Luka Doncic"].vid()}, {0, players_["Russell Westbrook"].vid()}, }; } } TEST_P(GoTest, ErrorMsg) { { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER serve YIELD $$.player.name as name"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<std::string>> expected = {""}; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, ZeroStep) { // Zero step { // #2100 // A cycle traversal cpp2::ExecutionResponse resp; auto *fmt = "GO 0 STEPS FROM %ld OVER serve BIDIRECT"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { }; ASSERT_TRUE(verifyResult(resp, expected)); } { // a normal traversal cpp2::ExecutionResponse resp; auto *fmt = "GO 0 STEPS FROM %ld OVER serve"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t>> expected = { }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, issue2087_go_cover_input) { // input with src and dst properties { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._src as src, like._dst as dst " "| GO FROM $-.src OVER like " "YIELD $-.src as src, like._dst as dst, $^.player.name, $$.player.name "; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, std::string, std::string>> expected = { {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), "Tim Duncan", "Tony Parker"}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), "Tim Duncan", "Manu Ginobili"}, {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), "Tim Duncan", "Tony Parker"}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), "Tim Duncan", "Manu Ginobili"}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // var { cpp2::ExecutionResponse resp; auto *fmt = "$a = GO FROM %ld OVER like YIELD like._src as src, like._dst as dst; " "GO FROM $a.src OVER like YIELD $a.src as src, like._dst as dst"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t>> expected = { {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // with intermidate data // pipe { cpp2::ExecutionResponse resp; auto &player = players_["Tim Duncan"]; auto *fmt = "GO FROM %ld OVER like YIELD like._src as src, like._dst as dst " "| GO 1 TO 2 STEPS FROM $-.src OVER like YIELD $-.src as src, like._dst as dst"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID, VertexID>> expected = { {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, {players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } // var with properties { cpp2::ExecutionResponse resp; auto &player = players_["Tim Duncan"]; auto *fmt = "GO FROM %ld OVER like YIELD like._src as src, like._dst as dst " "| GO 1 TO 2 STEPS FROM $-.src OVER like YIELD" " $-.src as src, $-.dst, like._dst as dst, like.likeness"; auto query = folly::stringPrintf(fmt, player.vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<VertexID, VertexID, VertexID, int64_t>> expected = { {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tony Parker"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tony Parker"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), 90}, // NOLINT {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), 90}, // NOLINT {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), 90}, // NOLINT {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), 90}, // NOLINT }; ASSERT_TRUE(verifyResult(resp, expected)); } // partial neighbors // input { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._src AS src, like._dst AS dst " "| GO FROM $-.dst OVER teammate YIELD $-.src AS src, $-.dst, teammate._dst AS dst"; auto query = folly::stringPrintf(fmt, players_["Danny Green"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, int64_t>> expected = { {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, // NOLINT {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Danny Green"].vid()}, // NOLINT }; ASSERT_TRUE(verifyResult(resp, expected)); } // var { cpp2::ExecutionResponse resp; auto *fmt = "$a = GO FROM %ld OVER like YIELD like._src AS src, like._dst AS dst; " "GO FROM $a.dst OVER teammate YIELD $a.src AS src, $a.dst, teammate._dst AS dst"; auto query = folly::stringPrintf(fmt, players_["Danny Green"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector<std::tuple<int64_t, int64_t, int64_t>> expected = { {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, // NOLINT {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Danny Green"].vid()}, // NOLINT }; ASSERT_TRUE(verifyResult(resp, expected)); } } TEST_P(GoTest, issueBackTrackOverlap) { // require there are edges in one steps like below: // dst, src // 7 , 1 // 1 , 7 // In total , one src is anthoer one's dst { std::vector<std::tuple<int64_t, int64_t, int64_t, int64_t>> expected = { {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT }; { cpp2::ExecutionResponse resp; auto *fmt = "GO FROM %ld OVER like YIELD like._src as src, like._dst as dst " "| GO 2 STEPS FROM $-.src OVER like YIELD $-.src, $-.dst, like._src, like._dst"; auto query = folly::stringPrintf(fmt, players_["Tony Parker"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "$a = GO FROM %ld OVER like YIELD like._src as src, like._dst as dst; " "GO 2 STEPS FROM $a.src OVER like YIELD $a.src, $a.dst, like._src, like._dst"; auto query = folly::stringPrintf(fmt, players_["Tony Parker"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_TRUE(verifyResult(resp, expected)); } } } TEST_P(GoTest, NStepQueryHangAndOOM) { { std::vector<std::tuple<VertexID>> expected = { {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid()}, {players_["LaMarcus Aldridge"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Tony Parker"].vid()}, {players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid()}, {players_["Tony Parker"].vid()}, }; { cpp2::ExecutionResponse resp; auto *fmt = "GO 1 TO 3 STEPS FROM %ld OVER like YIELD like._dst as dst"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "YIELD %ld as id " "| GO 1 TO 3 STEPS FROM $-.id OVER like YIELD like._dst as dst"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); ASSERT_TRUE(verifyResult(resp, expected)); } { cpp2::ExecutionResponse resp; auto *fmt = "GO 1 TO 40 STEPS FROM %ld OVER like YIELD like._dst as dst"; auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid()); auto code = client_->execute(query, resp); ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); } } } INSTANTIATE_TEST_CASE_P(IfPushdownFilter, GoTest, ::testing::Bool()); } // namespace graph } // namespace nebula
sty $ff cpx $ff bcc {la1}
////////////////////////////////////////////////////////////////////////////////////////// // A multi-platform support c++11 library with focus on asynchronous socket I/O for any // client application. // ////////////////////////////////////////////////////////////////////////////////////////// /* The MIT License (MIT) Copyright (c) 2012-2021 HALX99 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef YASIO__XXSOCKET_CPP #define YASIO__XXSOCKET_CPP #include <assert.h> #ifdef _DEBUG # include <stdio.h> #endif #if !defined(YASIO_HEADER_ONLY) # include "yasio/xxsocket.hpp" #endif #include "yasio/detail/utils.hpp" #if !defined(_WIN32) # include "yasio/detail/ifaddrs.hpp" #endif // For apple bsd socket implemention #if !defined(TCP_KEEPIDLE) # define TCP_KEEPIDLE TCP_KEEPALIVE #endif #if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable : 4996) #endif using namespace yasio; using namespace yasio::inet; #if defined(_WIN32) && !defined(_WINSTORE) static LPFN_ACCEPTEX __accept_ex = nullptr; static LPFN_GETACCEPTEXSOCKADDRS __get_accept_ex_sockaddrs = nullptr; static LPFN_CONNECTEX __connect_ex = nullptr; #endif #if !YASIO__HAS_NTOP namespace yasio { namespace inet { YASIO__NS_INLINE namespace ip { namespace compat { # include "yasio/detail/inet_compat.inl" } // namespace compat } // namespace ip } // namespace inet } // namespace yasio #endif int xxsocket::xpconnect(const char* hostname, u_short port, u_short local_port) { auto flags = getipsv(); int error = -1; xxsocket::resolve_i( [&](const endpoint& ep) { switch (ep.af()) { case AF_INET: if (flags & ipsv_ipv4) { error = pconnect(ep, local_port); } else if (flags & ipsv_ipv6) { xxsocket::resolve_i([&](const endpoint& ep6) { return 0 == (error = pconnect(ep6, local_port)); }, hostname, port, AF_INET6, AI_V4MAPPED); } break; case AF_INET6: if (flags & ipsv_ipv6) error = pconnect(ep, local_port); break; } return error == 0; }, hostname, port, AF_UNSPEC, AI_ALL); return error; } int xxsocket::xpconnect_n(const char* hostname, u_short port, const std::chrono::microseconds& wtimeout, u_short local_port) { auto flags = getipsv(); int error = -1; xxsocket::resolve_i( [&](const endpoint& ep) { switch (ep.af()) { case AF_INET: if (flags & ipsv_ipv4) error = pconnect_n(ep, wtimeout, local_port); else if (flags & ipsv_ipv6) { xxsocket::resolve_i([&](const endpoint& ep6) { return 0 == (error = pconnect_n(ep6, wtimeout, local_port)); }, hostname, port, AF_INET6, AI_V4MAPPED); } break; case AF_INET6: if (flags & ipsv_ipv6) error = pconnect_n(ep, wtimeout, local_port); break; } return error == 0; }, hostname, port, AF_UNSPEC, AI_ALL); return error; } int xxsocket::pconnect(const char* hostname, u_short port, u_short local_port) { int error = -1; xxsocket::resolve_i([&](const endpoint& ep) { return 0 == (error = pconnect(ep, local_port)); }, hostname, port); return error; } int xxsocket::pconnect_n(const char* hostname, u_short port, const std::chrono::microseconds& wtimeout, u_short local_port) { int error = -1; xxsocket::resolve_i([&](const endpoint& ep) { return 0 == (error = pconnect_n(ep, wtimeout, local_port)); }, hostname, port); return error; } int xxsocket::pconnect_n(const char* hostname, u_short port, u_short local_port) { int error = -1; xxsocket::resolve_i( [&](const endpoint& ep) { (error = pconnect_n(ep, local_port)); return true; }, hostname, port); return error; } int xxsocket::pconnect(const endpoint& ep, u_short local_port) { if (this->reopen(ep.af())) { if (local_port != 0) this->bind(YASIO_ADDR_ANY(ep.af()), local_port); return this->connect(ep); } return -1; } int xxsocket::pconnect_n(const endpoint& ep, const std::chrono::microseconds& wtimeout, u_short local_port) { if (this->reopen(ep.af())) { if (local_port != 0) this->bind(YASIO_ADDR_ANY(ep.af()), local_port); return this->connect_n(ep, wtimeout); } return -1; } int xxsocket::pconnect_n(const endpoint& ep, u_short local_port) { if (this->reopen(ep.af())) { if (local_port != 0) this->bind(YASIO_ADDR_ANY(ep.af()), local_port); return xxsocket::connect_n(this->fd, ep); } return -1; } int xxsocket::pserve(const char* addr, u_short port) { return this->pserve(endpoint{addr, port}); } int xxsocket::pserve(const endpoint& ep) { if (!this->reopen(ep.af())) return -1; set_optval(SOL_SOCKET, SO_REUSEADDR, 1); int n = this->bind(ep); if (n != 0) return n; return this->listen(); } int xxsocket::resolve(std::vector<endpoint>& endpoints, const char* hostname, unsigned short port, int socktype) { return resolve_i( [&](const endpoint& ep) { endpoints.push_back(ep); return false; }, hostname, port, AF_UNSPEC, AI_ALL, socktype); } int xxsocket::resolve_v4(std::vector<endpoint>& endpoints, const char* hostname, unsigned short port, int socktype) { return resolve_i( [&](const endpoint& ep) { endpoints.push_back(ep); return false; }, hostname, port, AF_INET, 0, socktype); } int xxsocket::resolve_v6(std::vector<endpoint>& endpoints, const char* hostname, unsigned short port, int socktype) { return resolve_i( [&](const endpoint& ep) { endpoints.push_back(ep); return false; }, hostname, port, AF_INET6, 0, socktype); } int xxsocket::resolve_v4to6(std::vector<endpoint>& endpoints, const char* hostname, unsigned short port, int socktype) { return xxsocket::resolve_i( [&](const endpoint& ep) { endpoints.push_back(ep); return false; }, hostname, port, AF_INET6, AI_V4MAPPED, socktype); } int xxsocket::resolve_tov6(std::vector<endpoint>& endpoints, const char* hostname, unsigned short port, int socktype) { return resolve_i( [&](const endpoint& ep) { endpoints.push_back(ep); return false; }, hostname, port, AF_INET6, AI_ALL | AI_V4MAPPED, socktype); } int xxsocket::getipsv(void) { int flags = 0; xxsocket::traverse_local_address([&](const ip::endpoint& ep) -> bool { switch (ep.af()) { case AF_INET: flags |= ipsv_ipv4; break; case AF_INET6: flags |= ipsv_ipv6; break; } return (flags == ipsv_dual_stack); }); YASIO_LOG("xxsocket::getipsv: flags=%d", flags); return flags; } void xxsocket::traverse_local_address(std::function<bool(const ip::endpoint&)> handler) { int family = AF_UNSPEC; bool done = false; /* Only windows support use getaddrinfo to get local ip address(not loopback or linklocal), Because nullptr same as "localhost": always return loopback address and at unix/linux the gethostname always return "localhost" */ #if defined(_WIN32) char hostname[256] = {0}; ::gethostname(hostname, sizeof(hostname)); // ipv4 & ipv6 addrinfo hint, *ailist = nullptr; ::memset(&hint, 0x0, sizeof(hint)); endpoint ep; # if defined(_DEBUG) YASIO_LOG("xxsocket::traverse_local_address: localhost=%s", hostname); # endif int iret = getaddrinfo(hostname, nullptr, &hint, &ailist); const char* errmsg = nullptr; if (ailist != nullptr) { for (auto aip = ailist; aip != NULL; aip = aip->ai_next) { family = aip->ai_family; if (family == AF_INET || family == AF_INET6) { ep.as_is(aip); YASIO_LOGV("xxsocket::traverse_local_address: ip=%s", ep.ip().c_str()); switch (ep.af()) { case AF_INET: if (!IN4_IS_ADDR_LOOPBACK(&ep.in4_.sin_addr) && !IN4_IS_ADDR_LINKLOCAL(&ep.in4_.sin_addr)) done = handler(ep); break; case AF_INET6: if (IN6_IS_ADDR_GLOBAL(&ep.in6_.sin6_addr)) done = handler(ep); break; } if (done) break; } } freeaddrinfo(ailist); } else { errmsg = xxsocket::gai_strerror(iret); } #else // __APPLE__ or linux with <ifaddrs.h> struct ifaddrs *ifaddr, *ifa; /* The value of ifa->ifa_name: Android: wifi: "w" cellular: "r" iOS: wifi: "en0" cellular: "pdp_ip0" */ if (yasio::getifaddrs(&ifaddr) == -1) { YASIO_LOG("xxsocket::traverse_local_address: getifaddrs fail!"); return; } endpoint ep; /* Walk through linked list*/ for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { if (ifa->ifa_addr == NULL) continue; family = ifa->ifa_addr->sa_family; if (family == AF_INET || family == AF_INET6) { ep.as_is(ifa->ifa_addr); YASIO_LOGV("xxsocket::traverse_local_address: ip=%s", ep.ip().c_str()); switch (ep.af()) { case AF_INET: if (!IN4_IS_ADDR_LOOPBACK(&ep.in4_.sin_addr) && !IN4_IS_ADDR_LINKLOCAL(&ep.in4_.sin_addr)) done = handler(ep); break; case AF_INET6: if (IN6_IS_ADDR_GLOBAL(&ep.in6_.sin6_addr)) done = handler(ep); break; } if (done) break; } } yasio::freeifaddrs(ifaddr); #endif } xxsocket::xxsocket(void) : fd(invalid_socket) {} xxsocket::xxsocket(socket_native_type h) : fd(h) {} xxsocket::xxsocket(xxsocket&& right) : fd(invalid_socket) { swap(right); } xxsocket::xxsocket(int af, int type, int protocol) : fd(invalid_socket) { open(af, type, protocol); } xxsocket::~xxsocket(void) { close(); } xxsocket& xxsocket::operator=(socket_native_type handle) { if (!this->is_open()) this->fd = handle; return *this; } xxsocket& xxsocket::operator=(xxsocket&& right) { return swap(right); } xxsocket& xxsocket::swap(xxsocket& rhs) { std::swap(this->fd, rhs.fd); return *this; } bool xxsocket::open(int af, int type, int protocol) { if (invalid_socket == this->fd) this->fd = ::socket(af, type, protocol); return is_open(); } bool xxsocket::reopen(int af, int type, int protocol) { this->close(); return this->open(af, type, protocol); } #if defined(_WIN32) && !defined(_WINSTORE) bool xxsocket::open_ex(int af, int type, int protocol) { # if !defined(WP8) if (invalid_socket == this->fd) { this->fd = ::WSASocket(af, type, protocol, nullptr, 0, WSA_FLAG_OVERLAPPED); DWORD dwBytes = 0; if (nullptr == __accept_ex) { GUID guidAcceptEx = WSAID_ACCEPTEX; (void)WSAIoctl(this->fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &guidAcceptEx, sizeof(guidAcceptEx), &__accept_ex, sizeof(__accept_ex), &dwBytes, nullptr, nullptr); } if (nullptr == __connect_ex) { GUID guidConnectEx = WSAID_CONNECTEX; (void)WSAIoctl(this->fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &guidConnectEx, sizeof(guidConnectEx), &__connect_ex, sizeof(__connect_ex), &dwBytes, nullptr, nullptr); } if (nullptr == __get_accept_ex_sockaddrs) { GUID guidGetAcceptExSockaddrs = WSAID_GETACCEPTEXSOCKADDRS; (void)WSAIoctl(this->fd, SIO_GET_EXTENSION_FUNCTION_POINTER, &guidGetAcceptExSockaddrs, sizeof(guidGetAcceptExSockaddrs), &__get_accept_ex_sockaddrs, sizeof(__get_accept_ex_sockaddrs), &dwBytes, nullptr, nullptr); } } return is_open(); # else return false; # endif } # if !defined(WP8) bool xxsocket::accept_ex(SOCKET sockfd_listened, SOCKET sockfd_prepared, PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, LPDWORD lpdwBytesReceived, LPOVERLAPPED lpOverlapped) { return __accept_ex(sockfd_listened, sockfd_prepared, lpOutputBuffer, dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength, lpdwBytesReceived, lpOverlapped) != FALSE; } bool xxsocket::connect_ex(SOCKET s, const struct sockaddr* name, int namelen, PVOID lpSendBuffer, DWORD dwSendDataLength, LPDWORD lpdwBytesSent, LPOVERLAPPED lpOverlapped) { return __connect_ex(s, name, namelen, lpSendBuffer, dwSendDataLength, lpdwBytesSent, lpOverlapped); } void xxsocket::translate_sockaddrs(PVOID lpOutputBuffer, DWORD dwReceiveDataLength, DWORD dwLocalAddressLength, DWORD dwRemoteAddressLength, sockaddr** LocalSockaddr, LPINT LocalSockaddrLength, sockaddr** RemoteSockaddr, LPINT RemoteSockaddrLength) { __get_accept_ex_sockaddrs(lpOutputBuffer, dwReceiveDataLength, dwLocalAddressLength, dwRemoteAddressLength, LocalSockaddr, LocalSockaddrLength, RemoteSockaddr, RemoteSockaddrLength); } # endif #endif bool xxsocket::is_open(void) const { return this->fd != invalid_socket; } socket_native_type xxsocket::native_handle(void) const { return this->fd; } socket_native_type xxsocket::release_handle(void) { socket_native_type result = this->fd; this->fd = invalid_socket; return result; } int xxsocket::set_nonblocking(bool nonblocking) const { return set_nonblocking(this->fd, nonblocking); } int xxsocket::set_nonblocking(socket_native_type s, bool nonblocking) { #if defined(_WIN32) u_long argp = nonblocking; return ::ioctlsocket(s, FIONBIO, &argp); #else int flags = ::fcntl(s, F_GETFL, 0); return ::fcntl(s, F_SETFL, nonblocking ? (flags | O_NONBLOCK) : (flags & ~O_NONBLOCK)); #endif } int xxsocket::test_nonblocking() const { return xxsocket::test_nonblocking(this->fd); } int xxsocket::test_nonblocking(socket_native_type s) { #if defined(_WIN32) int r = 0; unsigned char b[1]; r = xxsocket::recv(s, b, 0, 0); if (r == 0) return 1; else if (r == -1 && GetLastError() == WSAEWOULDBLOCK) return 0; return -1; /* In case it is a connection socket (TCP) and it is not in connected state you will get here 10060 */ #else int flags = ::fcntl(s, F_GETFL, 0); return flags & O_NONBLOCK; #endif } int xxsocket::bind(const char* addr, unsigned short port) const { return this->bind(endpoint(addr, port)); } int xxsocket::bind(const endpoint& ep) const { return ::bind(this->fd, &ep.sa_, ep.len()); } int xxsocket::bind_any(bool ipv6) const { return this->bind(endpoint(!ipv6 ? "0.0.0.0" : "::", 0)); } int xxsocket::listen(int backlog) const { return ::listen(this->fd, backlog); } xxsocket xxsocket::accept() const { return ::accept(this->fd, nullptr, nullptr); } int xxsocket::accept_n(socket_native_type& new_sock) const { for (;;) { // Accept the waiting connection. new_sock = ::accept(this->fd, nullptr, nullptr); // Check if operation succeeded. if (new_sock != invalid_socket) { xxsocket::set_nonblocking(new_sock, true); return 0; } auto error = get_last_errno(); // Retry operation if interrupted by signal. if (error == EINTR) continue; /* Operation failed. ** The error maybe EWOULDBLOCK, EAGAIN, ECONNABORTED, EPROTO, ** Simply Fall through to retry operation. */ return error; } } int xxsocket::connect(const char* addr, u_short port) { return connect(endpoint(addr, port)); } int xxsocket::connect(const endpoint& ep) { return xxsocket::connect(fd, ep); } int xxsocket::connect(socket_native_type s, const char* addr, u_short port) { endpoint peer(addr, port); return xxsocket::connect(s, peer); } int xxsocket::connect(socket_native_type s, const endpoint& ep) { return ::connect(s, &ep.sa_, ep.len()); } int xxsocket::connect_n(const char* addr, u_short port, const std::chrono::microseconds& wtimeout) { return connect_n(ip::endpoint(addr, port), wtimeout); } int xxsocket::connect_n(const endpoint& ep, const std::chrono::microseconds& wtimeout) { return this->connect_n(this->fd, ep, wtimeout); } int xxsocket::connect_n(socket_native_type s, const endpoint& ep, const std::chrono::microseconds& wtimeout) { fd_set rset, wset; int n, error = 0; set_nonblocking(s, true); if ((n = xxsocket::connect(s, ep)) < 0) { error = xxsocket::get_last_errno(); if (error != EINPROGRESS && error != EWOULDBLOCK) return -1; } /* Do whatever we want while the connect is taking place. */ if (n == 0) goto done; /* connect completed immediately */ if ((n = xxsocket::select(s, &rset, &wset, NULL, wtimeout)) <= 0) error = xxsocket::get_last_errno(); else if ((FD_ISSET(s, &rset) || FD_ISSET(s, &wset))) { /* Everythings are ok */ socklen_t len = sizeof(error); if (::getsockopt(s, SOL_SOCKET, SO_ERROR, (char*)&error, &len) < 0) return (-1); /* Solaris pending error */ } done: if (error != 0) { ::closesocket(s); /* just in case */ return (-1); } /* Since v3.31.2, we don't restore file status flags for unify behavior for all platforms */ // pitfall: because on win32, there is no way to test whether the s is non-blocking // so, can't restore properly return (0); } int xxsocket::connect_n(const endpoint& ep) { return xxsocket::connect_n(this->fd, ep); } int xxsocket::connect_n(socket_native_type s, const endpoint& ep) { set_nonblocking(s, true); return xxsocket::connect(s, ep); } int xxsocket::disconnect() const { return xxsocket::disconnect(this->fd); } int xxsocket::disconnect(socket_native_type s) { sockaddr addr_unspec = {0}; addr_unspec.sa_family = AF_UNSPEC; return ::connect(s, &addr_unspec, sizeof(addr_unspec)); } int xxsocket::send_n(const void* buf, int len, const std::chrono::microseconds& wtimeout, int flags) { return this->send_n(this->fd, buf, len, wtimeout, flags); } int xxsocket::send_n(socket_native_type s, const void* buf, int len, std::chrono::microseconds wtimeout, int flags) { int bytes_transferred = 0; int n; int error = 0; xxsocket::set_nonblocking(s, true); for (; bytes_transferred < len;) { // Try to transfer as much of the remaining data as possible. // Since the socket is in non-blocking mode, this call will not // block. n = xxsocket::send(s, (const char*)buf + bytes_transferred, len - bytes_transferred, flags); if (n > 0) { bytes_transferred += n; continue; } // Check for possible blocking. error = xxsocket::get_last_errno(); if (n == -1 && xxsocket::not_send_error(error)) { // Wait upto <timeout> for the blocking to subside. auto start = yasio::highp_clock(); int const rtn = handle_write_ready(s, wtimeout); wtimeout -= std::chrono::microseconds(yasio::highp_clock() - start); // Did select() succeed? if (rtn != -1 && wtimeout.count() > 0) { // Blocking subsided in <timeout> period. Continue // data transfer. continue; } } // Wait in select() timed out or other data transfer or // select() failures. break; } return bytes_transferred; } int xxsocket::recv_n(void* buf, int len, const std::chrono::microseconds& wtimeout, int flags) const { return this->recv_n(this->fd, buf, len, wtimeout, flags); } int xxsocket::recv_n(socket_native_type s, void* buf, int len, std::chrono::microseconds wtimeout, int flags) { int bytes_transferred = 0; int n; int error = 0; xxsocket::set_nonblocking(s, true); for (; bytes_transferred < len;) { // Try to transfer as much of the remaining data as possible. // Since the socket is in non-blocking mode, this call will not // block. n = xxsocket::recv(s, static_cast<char*>(buf) + bytes_transferred, len - bytes_transferred, flags); if (n > 0) { bytes_transferred += n; continue; } // Check for possible blocking. error = xxsocket::get_last_errno(); if (n == -1 && xxsocket::not_recv_error(error)) { // Wait upto <timeout> for the blocking to subside. auto start = yasio::highp_clock(); int const rtn = handle_read_ready(s, wtimeout); wtimeout -= std::chrono::microseconds(yasio::highp_clock() - start); // Did select() succeed? if (rtn != -1 && wtimeout.count() > 0) { // Blocking subsided in <timeout> period. Continue // data transfer. continue; } } // Wait in select() timed out or other data transfer or // select() failures. break; } return bytes_transferred; } int xxsocket::send(const void* buf, int len, int flags) const { return static_cast<int>(::send(this->fd, (const char*)buf, len, flags)); } int xxsocket::send(socket_native_type s, const void* buf, int len, int flags) { return static_cast<int>(::send(s, (const char*)buf, len, flags)); } int xxsocket::recv(void* buf, int len, int flags) const { return static_cast<int>(this->recv(this->fd, buf, len, flags)); } int xxsocket::recv(socket_native_type s, void* buf, int len, int flags) { return static_cast<int>(::recv(s, (char*)buf, len, flags)); } int xxsocket::sendto(const void* buf, int len, const endpoint& to, int flags) const { return static_cast<int>(::sendto(this->fd, (const char*)buf, len, flags, &to.sa_, to.len())); } int xxsocket::recvfrom(void* buf, int len, endpoint& from, int flags) const { socklen_t addrlen{sizeof(from)}; int n = static_cast<int>(::recvfrom(this->fd, (char*)buf, len, flags, &from.sa_, &addrlen)); from.len(addrlen); return n; } int xxsocket::handle_write_ready(const std::chrono::microseconds& wtimeout) const { return handle_write_ready(this->fd, wtimeout); } int xxsocket::handle_write_ready(socket_native_type s, const std::chrono::microseconds& wtimeout) { fd_set writefds; return xxsocket::select(s, nullptr, &writefds, nullptr, wtimeout); } int xxsocket::handle_read_ready(const std::chrono::microseconds& wtimeout) const { return handle_read_ready(this->fd, wtimeout); } int xxsocket::handle_read_ready(socket_native_type s, const std::chrono::microseconds& wtimeout) { fd_set readfds; return xxsocket::select(s, &readfds, nullptr, nullptr, wtimeout); } int xxsocket::select(socket_native_type s, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, std::chrono::microseconds wtimeout) { int n = 0; for (;;) { reregister_descriptor(s, readfds); reregister_descriptor(s, writefds); reregister_descriptor(s, exceptfds); timeval waitd_tv = {static_cast<decltype(timeval::tv_sec)>(wtimeout.count() / std::micro::den), static_cast<decltype(timeval::tv_usec)>(wtimeout.count() % std::micro::den)}; long long start = highp_clock(); n = ::select(static_cast<int>(s + 1), readfds, writefds, exceptfds, &waitd_tv); wtimeout -= std::chrono::microseconds(highp_clock() - start); if (n < 0 && xxsocket::get_last_errno() == EINTR) { if (wtimeout.count() > 0) continue; n = 0; } if (n == 0) xxsocket::set_last_errno(ETIMEDOUT); break; } return n; } void xxsocket::reregister_descriptor(socket_native_type s, fd_set* fds) { if (fds) { FD_ZERO(fds); FD_SET(s, fds); } } endpoint xxsocket::local_endpoint(void) const { return local_endpoint(this->fd); } endpoint xxsocket::local_endpoint(socket_native_type fd) { endpoint ep; socklen_t socklen = sizeof(ep); getsockname(fd, &ep.sa_, &socklen); ep.len(socklen); return ep; } endpoint xxsocket::peer_endpoint(void) const { return peer_endpoint(this->fd); } endpoint xxsocket::peer_endpoint(socket_native_type fd) { endpoint ep; socklen_t socklen = sizeof(ep); getpeername(fd, &ep.sa_, &socklen); ep.len(socklen); return ep; } int xxsocket::set_keepalive(int flag, int idle, int interval, int probes) { return set_keepalive(this->fd, flag, idle, interval, probes); } int xxsocket::set_keepalive(socket_native_type s, int flag, int idle, int interval, int probes) { #if defined(_WIN32) && !defined(WP8) && !defined(_WINSTORE) tcp_keepalive buffer_in; buffer_in.onoff = flag; buffer_in.keepalivetime = idle * 1000; buffer_in.keepaliveinterval = interval * 1000; return WSAIoctl(s, SIO_KEEPALIVE_VALS, &buffer_in, sizeof(buffer_in), nullptr, 0, (DWORD*)&probes, nullptr, nullptr); #else int n = set_optval(s, SOL_SOCKET, SO_KEEPALIVE, flag); n += set_optval(s, IPPROTO_TCP, TCP_KEEPIDLE, idle); n += set_optval(s, IPPROTO_TCP, TCP_KEEPINTVL, interval); n += set_optval(s, IPPROTO_TCP, TCP_KEEPCNT, probes); return n; #endif } void xxsocket::reuse_address(bool reuse) { int optval = reuse ? 1 : 0; // All operating systems have 'SO_REUSEADDR' this->set_optval(SOL_SOCKET, SO_REUSEADDR, optval); #if defined(SO_REUSEPORT) // macos,ios,linux,android this->set_optval(SOL_SOCKET, SO_REUSEPORT, optval); #endif } void xxsocket::exclusive_address(bool exclusive) { #if defined(SO_EXCLUSIVEADDRUSE) this->set_optval(SOL_SOCKET, SO_EXCLUSIVEADDRUSE, exclusive ? 1 : 0); #elif defined(SO_EXCLBIND) this->set_optval(SOL_SOCKET, SO_EXCLBIND, exclusive ? 1 : 0); #endif } xxsocket::operator socket_native_type(void) const { return this->fd; } int xxsocket::shutdown(int how) const { return ::shutdown(this->fd, how); } void xxsocket::close(int shut_how) { if (is_open()) { if (shut_how >= 0) ::shutdown(this->fd, shut_how); ::closesocket(this->fd); this->fd = invalid_socket; } } uint32_t xxsocket::tcp_rtt() const { return xxsocket::tcp_rtt(this->fd); } uint32_t xxsocket::tcp_rtt(socket_native_type s) { #if defined(_WIN32) # if defined(NTDDI_WIN10_RS2) && NTDDI_VERSION >= NTDDI_WIN10_RS2 TCP_INFO_v0 info; DWORD tcpi_ver = 0, bytes_transferred = 0; int status = WSAIoctl(s, SIO_TCP_INFO, (LPVOID)&tcpi_ver, // lpvInBuffer pointer to a DWORD, version of tcp info (DWORD)sizeof(tcpi_ver), // size, in bytes, of the input buffer (LPVOID)&info, // pointer to a TCP_INFO_v0 structure (DWORD)sizeof(info), // size of the output buffer (LPDWORD)&bytes_transferred, // number of bytes returned (LPWSAOVERLAPPED) nullptr, // OVERLAPPED structure (LPWSAOVERLAPPED_COMPLETION_ROUTINE) nullptr); /* info.RttUs: The current estimated round-trip time for the connection, in microseconds. info.MinRttUs: The minimum sampled round trip time, in microseconds. */ if (status == 0) return info.RttUs; # endif #elif defined(__linux__) struct tcp_info info; int length = sizeof(struct tcp_info); if (0 == xxsocket::get_optval(s, IPPROTO_TCP, TCP_INFO, info)) return info.tcpi_rtt; #elif defined(__APPLE__) struct tcp_connection_info info; int length = sizeof(struct tcp_connection_info); /* info.tcpi_srtt: average RTT in ms info.tcpi_rttcur: most recent RTT in ms */ if (0 == xxsocket::get_optval(s, IPPROTO_TCP, TCP_CONNECTION_INFO, info)) return info.tcpi_srtt * std::milli::den; #endif return 0; } void xxsocket::init_ws32_lib(void) {} int xxsocket::get_last_errno(void) { #if defined(_WIN32) return ::WSAGetLastError(); #else return errno; #endif } void xxsocket::set_last_errno(int error) { #if defined(_WIN32) ::WSASetLastError(error); #else errno = error; #endif } bool xxsocket::not_send_error(int error) { return (error == EWOULDBLOCK || error == EAGAIN || error == EINTR || error == ENOBUFS); } bool xxsocket::not_recv_error(int error) { return (error == EWOULDBLOCK || error == EAGAIN || error == EINTR); } const char* xxsocket::strerror(int error) { #if defined(_MSC_VER) && !defined(_WINSTORE) static char error_msg[256]; ZeroMemory(error_msg, sizeof(error_msg)); ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK /* remove line-end charactors \r\n */, NULL, error, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), // english language error_msg, sizeof(error_msg), NULL); return error_msg; #else return ::strerror(error); #endif } const char* xxsocket::gai_strerror(int error) { #if defined(_WIN32) return xxsocket::strerror(error); #else return ::gai_strerror(error); #endif } // initialize win32 socket library #ifdef _WIN32 namespace { struct ws2_32_gc { ws2_32_gc(void) { WSADATA dat = {0}; WSAStartup(0x0202, &dat); } ~ws2_32_gc(void) { WSACleanup(); } }; ws2_32_gc __ws32_lib_gc; } // namespace #endif #if defined(_MSC_VER) # pragma warning(pop) #endif #endif
;============================================================== ; BIG EVIL CORPORATION .co.uk ;============================================================== ; SEGA Genesis Framework (c) Matt Phillips 2014 ;============================================================== ; palettes.asm - Palette loading and manipulation ;============================================================== LoadPalette; ; d0 (b) Palette index ; a0 --- Palette ROM address mulu.w #SizePalette, d0 ; Colour index to CRAM destination address swap d0 ; Move address to upper word ori.l #vdp_write_palettes, d0 ; OR CRAM write command move.l d0, vdp_control ; Send dest address to VDP move.l #(SizePalette/SizeWord), d0 ; Size of palette @PaletteCopy: move.w (a0)+, vdp_data ; Move word to CRAM dbra.w d0, @PaletteCopy rts ReadPalette; ; d0 (b) Palette index ; a0 --- Dest RAM address mulu.w #SizePalette, d0 ; Colour index to CRAM source address swap d0 ; Move address to upper word ori.l #vdp_read_palettes, d0 ; OR CRAM read command move.l d0, vdp_control ; Send dest address to VDP move.l #(SizePalette/SizeWord), d0 ; Size of palette @PaletteCopy: move.w vdp_data, (a0)+ ; Move word from CRAM dbra.w d0, @PaletteCopy rts
#include <iostream> #include <vector> #include <time.h> #include "GASimpleGA.h" #include "GASStateGA.h" #include "GA1DArrayGenome.h" #include "sbml_sim.h" extern "C" { #include "mtrand.h" #include "opt.h" } using namespace std; typedef GA1DArrayGenome<float> RealGenome; vector< vector<double> > actual; SBML_sim * model; double end_time = 20; double dt = 0.1; void initializeGenome(GAGenome & x) { RealGenome & g = (RealGenome &)x; for (int i=0; i < g.size(); ++i) g.gene(i,0) = mtrand() * pow(10.0, 2.0*mtrand()); } float EuclideanDistance(const GAGenome & c1, const GAGenome & c2) { const RealGenome & a = (RealGenome &)c1; const RealGenome & b = (RealGenome &)c2; float x=0.0; for(int i=0; i < b.length() && i < a.length(); ++i) x += (a.gene(i) - b.gene(i))*(a.gene(i) - b.gene(i)); return (float)sqrt(x); } double diff(int n, double * p) { vector<double> params(n,0); for (int i=0; i < n; ++i) params[i] = p[i]; model->setParameters(params); vector< vector<double> > res = model->simulate(end_time, dt); if (res.size() < 1) return 100.0; double sumsq = 0.0, d = 0.0; for (int i=1; i < res.size(); ++i) { for (int j=0; j < res[i].size(); ++j) { d = res[i][j] - actual[i][j]; sumsq += d*d; } } return (float)(sumsq/ (res[0].size()));// * (res.size()-1))); } float Objective1(GAGenome & x) { RealGenome & g = (RealGenome &)x; vector<double> params(g.size(),0); for (int i=0; i < g.size(); ++i) params[i] = g.gene(i); model->setParameters(params); vector< vector<double> > res = model->simulate(end_time, dt); if (res.size() < 1) return 100.0; double sumsq = 0.0, d = 0.0; for (int i=1; i < res.size(); ++i) { for (int j=0; j < res[i].size(); ++j) { d = res[i][j] - actual[i][j]; sumsq += d*d; } } return (float)(sumsq/ (res[0].size()));// * (res.size()-1))); } int main() { string sbml("feedback.xml"); SBML_sim sim(sbml); FILE * file1 = fopen("out1.tab","w"); FILE * file2 = fopen("out2.tab","w"); FILE * file3 = fopen("out3.tab","w"); FILE * file4 = fopen("pop.tab","w"); initMTrand(); actual = sim.simulate(end_time, dt); model = &sim; int n = actual.size(); if (n > 0) { int m = actual[0].size(); for (int i=0; i < m; ++i) { for (int j=0; j < n; ++j) fprintf(file1, "%lf\t",actual[j][i]); fprintf(file1, "\n"); } } vector<double> params = sim.getParameterValues(); vector<string> paramNames = sim.getParameterNames(); int numParams = params.size(); double * x0 = (double*)malloc(numParams * sizeof(double)); for (int i=0; i < numParams; ++i) x0[i] = mtrand() * 100.0; double fopt = 0.0; for (int i=0; i < numParams; ++i) cout << paramNames[i] << "\t"; cout << endl << endl; for (int i=0; i < numParams; ++i) cout << params[i] << "\t"; cout << endl << endl; // NelderMeadSimplexMethod(sim.getVariableNames().size(), diff , x0 , 10 , &fopt, 10000, 1E-3); RealGenome genome( numParams, &Objective1); genome.initializer(&initializeGenome); GASteadyStateGA ga(genome); //model_data * u = (model_data*)makeModelData(); //ga.userData(u); time_t seconds; seconds = time(NULL); GASharing dist(EuclideanDistance); ga.scaling(dist); ga.pReplacement(1.0); ga.minimize(); ga.populationSize(1000); ga.nGenerations(100); ga.pMutation(0.2); ga.pCrossover(0.9); GAPopulation pop; ga.evolve(); pop = ga.population(); pop.order(GAPopulation::HIGH_IS_BEST); pop.sort(gaTrue); for (int i=0; i < pop.size(); ++i) { RealGenome & g = (RealGenome &)(pop.individual(i)); for (int j=0; j < g.size(); ++j) fprintf(file4, "%lf\t", g.gene(j)); fprintf(file4,"%lf\n", g.score()); } RealGenome & g = (RealGenome &)(pop.individual(0)); cout << g.score() << endl; sim.setParameters(params); actual = sim.simulate(end_time, dt); n = actual.size(); if (n > 0) { int m = actual[0].size(); for (int i=0; i < m; ++i) { for (int j=0; j < n; ++j) fprintf(file2, "%lf\t",actual[j][i]); fprintf(file2, "\n"); } } g = (RealGenome &)(pop.individual(pop.size()-1)); cout << g.score() << endl; sim.setParameters(params); actual = sim.simulate(end_time, dt); n = actual.size(); if (n > 0) { int m = actual[0].size(); for (int i=0; i < m; ++i) { for (int j=0; j < n; ++j) fprintf(file3, "%lf\t",actual[j][i]); fprintf(file3, "\n"); } } printf("time = %i seconds\n", (int)(time(NULL)-seconds)); fclose(file1); fclose(file2); fclose(file3); fclose(file4); delete x0; return 0; }
; =============================================================== ; Jan 2014 ; =============================================================== ; ; int fflush(FILE *stream) ; ; Flush the stream. For streams most recently written to, this ; means sending any buffered output to the device. For streams ; most recently read from, this means seeking backward to unread ; any unconsumed input. ; ; If stream == 0, all streams are flushed. ; ; =============================================================== INCLUDE "clib_cfg.asm" SECTION code_clib SECTION code_stdio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF __CLIB_OPT_MULTITHREAD & $02 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC asm_fflush PUBLIC asm0_fflush, asm1_fflush EXTERN asm1_fflush_unlocked, asm__fflushall, __stdio_lock_release asm_fflush: ; enter : ix = FILE * ; ; exit : ix = FILE * ; ; if success ; ; hl = 0 ; carry reset ; ; if lock could not be acquired ; if stream is in error state ; if write failed ; ; hl = -1 ; carry set ; ; uses : all except ix ld a,ixl or ixh jp z, asm__fflushall asm0_fflush: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF __CLIB_OPT_STDIO & $01 EXTERN __stdio_verify_valid_lock call __stdio_verify_valid_lock ret c ELSE EXTERN __stdio_lock_acquire, error_enolck_mc call __stdio_lock_acquire jp c, error_enolck_mc ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; call asm1_fflush_unlocked jp __stdio_lock_release ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELSE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC asm_fflush EXTERN asm_fflush_unlocked defc asm_fflush = asm_fflush_unlocked ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/* * Copyright (C) 2013, British Broadcasting Corporation * All Rights Reserved. * * Author: Philip de Nier * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the British Broadcasting Corporation nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <libMXF++/MXF.h> using namespace std; using namespace mxfpp; const mxfKey ANCDataDescriptorBase::setKey = MXF_SET_K(ANCDataDescriptor); ANCDataDescriptorBase::ANCDataDescriptorBase(HeaderMetadata *headerMetadata) : GenericDataEssenceDescriptor(headerMetadata, headerMetadata->createCSet(&setKey)) { headerMetadata->add(this); } ANCDataDescriptorBase::ANCDataDescriptorBase(HeaderMetadata *headerMetadata, ::MXFMetadataSet *cMetadataSet) : GenericDataEssenceDescriptor(headerMetadata, cMetadataSet) {} ANCDataDescriptorBase::~ANCDataDescriptorBase() {}
; A265411: a(0) = 1, a(1) = 7, otherwise, if A240025(n-1) = 1 [when n is in A033638] a(n) = 3, otherwise a(n) = 1. ; 1,7,3,3,1,3,1,3,1,1,3,1,1,3,1,1,1,3,1,1,1,3,1,1,1,1,3,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,3,1,1,1,1,1,1,3,1,1,1,1,1,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1 mov $3,2 mov $4,$0 lpb $3 mov $0,$4 sub $3,1 add $0,$3 trn $0,1 seq $0,265412 ; Partial sums of A265411. mov $2,$3 mul $2,$0 add $1,$2 mov $5,$0 lpe min $4,1 mul $4,$5 sub $1,$4 mov $0,$1
/* Copyright (c) 2003 - 2006, Arvid Norberg Copyright (c) 2007, Arvid Norberg, Un Shyam All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef TORRENT_BT_PEER_CONNECTION_HPP_INCLUDED #define TORRENT_BT_PEER_CONNECTION_HPP_INCLUDED #include <ctime> #include <algorithm> #include <vector> #include <string> #include "libtorrent/debug.hpp" #ifdef _MSC_VER #pragma warning(push, 1) #endif #include <boost/smart_ptr.hpp> #include <boost/noncopyable.hpp> #include <boost/array.hpp> #include <boost/optional.hpp> #include <boost/cstdint.hpp> #ifdef _MSC_VER #pragma warning(pop) #endif #include "libtorrent/buffer.hpp" #include "libtorrent/peer_connection.hpp" #include "libtorrent/socket.hpp" #include "libtorrent/peer_id.hpp" #include "libtorrent/storage.hpp" #include "libtorrent/stat.hpp" #include "libtorrent/alert.hpp" #include "libtorrent/torrent_handle.hpp" #include "libtorrent/torrent.hpp" #include "libtorrent/peer_request.hpp" #include "libtorrent/piece_block_progress.hpp" #include "libtorrent/config.hpp" #include "libtorrent/pe_crypto.hpp" namespace libtorrent { class torrent; namespace detail { struct session_impl; } class TORRENT_EXPORT bt_peer_connection : public peer_connection { friend class invariant_access; public: // this is the constructor where the we are the active part. // The peer_conenction should handshake and verify that the // other end has the correct id bt_peer_connection( aux::session_impl& ses , boost::weak_ptr<torrent> t , boost::shared_ptr<socket_type> s , tcp::endpoint const& remote , policy::peer* peerinfo); // with this constructor we have been contacted and we still don't // know which torrent the connection belongs to bt_peer_connection( aux::session_impl& ses , boost::shared_ptr<socket_type> s , tcp::endpoint const& remote , policy::peer* peerinfo); void start(); enum { upload_only_msg = 2 }; ~bt_peer_connection(); #ifndef TORRENT_DISABLE_ENCRYPTION bool supports_encryption() const { return m_encrypted; } #endif enum message_type { // standard messages msg_choke = 0, msg_unchoke, msg_interested, msg_not_interested, msg_have, msg_bitfield, msg_request, msg_piece, msg_cancel, // DHT extension msg_dht_port, // FAST extension msg_suggest_piece = 0xd, msg_have_all, msg_have_none, msg_reject_request, msg_allowed_fast, // extension protocol message msg_extended = 20, num_supported_messages }; // called from the main loop when this connection has any // work to do. void on_sent(error_code const& error , std::size_t bytes_transferred); void on_receive(error_code const& error , std::size_t bytes_transferred); virtual void get_specific_peer_info(peer_info& p) const; virtual bool in_handshake() const; #ifndef TORRENT_DISABLE_EXTENSIONS bool support_extensions() const { return m_supports_extensions; } template <class T> T* supports_extension() const { for (extension_list_t::const_iterator i = m_extensions.begin() , end(m_extensions.end()); i != end; ++i) { T* ret = dynamic_cast<T*>(i->get()); if (ret) return ret; } return 0; } #endif // the message handlers are called // each time a recv() returns some new // data, the last time it will be called // is when the entire packet has been // received, then it will no longer // be called. i.e. most handlers need // to check how much of the packet they // have received before any processing void on_keepalive(); void on_choke(int received); void on_unchoke(int received); void on_interested(int received); void on_not_interested(int received); void on_have(int received); void on_bitfield(int received); void on_request(int received); void on_piece(int received); void on_cancel(int received); // DHT extension void on_dht_port(int received); // FAST extension void on_suggest_piece(int received); void on_have_all(int received); void on_have_none(int received); void on_reject_request(int received); void on_allowed_fast(int received); void on_extended(int received); void on_extended_handshake(); typedef void (bt_peer_connection::*message_handler)(int received); // the following functions appends messages // to the send buffer void write_choke(); void write_unchoke(); void write_interested(); void write_not_interested(); void write_request(peer_request const& r); void write_cancel(peer_request const& r); void write_bitfield(); void write_have(int index); void write_piece(peer_request const& r, disk_buffer_holder& buffer); void write_handshake(); #ifndef TORRENT_DISABLE_EXTENSIONS void write_extensions(); void write_upload_only(); #endif void write_metadata(std::pair<int, int> req); void write_metadata_request(std::pair<int, int> req); void write_keepalive(); // DHT extension void write_dht_port(int listen_port); // FAST extension void write_have_all(); void write_have_none(); void write_reject_request(peer_request const&); void write_allow_fast(int piece); void on_connected(); void on_metadata(); #ifdef TORRENT_DEBUG void check_invariant() const; ptime m_last_choke; #endif private: bool dispatch_message(int received); // returns the block currently being // downloaded. And the progress of that // block. If the peer isn't downloading // a piece for the moment, the boost::optional // will be invalid. boost::optional<piece_block_progress> downloading_piece_progress() const; #ifndef TORRENT_DISABLE_ENCRYPTION // if (is_local()), we are 'a' otherwise 'b' // // 1. a -> b dhkey, pad // 2. b -> a dhkey, pad // 3. a -> b sync, payload // 4. b -> a sync, payload // 5. a -> b payload void write_pe1_2_dhkey(); void write_pe3_sync(); void write_pe4_sync(int crypto_select); void write_pe_vc_cryptofield(buffer::interval& write_buf , int crypto_field, int pad_size); // stream key (info hash of attached torrent) // secret is the DH shared secret // initializes m_RC4_handler void init_pe_RC4_handler(char const* secret, sha1_hash const& stream_key); public: // these functions encrypt the send buffer if m_rc4_encrypted // is true, otherwise it passes the call to the // peer_connection functions of the same names virtual void append_const_send_buffer(char const* buffer, int size); void send_buffer(char const* buf, int size, int flags = 0); buffer::interval allocate_send_buffer(int size); template <class Destructor> void append_send_buffer(char* buffer, int size, Destructor const& destructor) { #ifndef TORRENT_DISABLE_ENCRYPTION if (m_rc4_encrypted) { TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes); m_RC4_handler->encrypt(buffer, size); #ifdef TORRENT_DEBUG m_encrypted_bytes += size; TORRENT_ASSERT(m_encrypted_bytes == send_buffer_size() + size); #endif } #endif peer_connection::append_send_buffer(buffer, size, destructor); } void setup_send(); private: void encrypt_pending_buffer(); // Returns offset at which bytestream (src, src + src_size) // matches bytestream(target, target + target_size). // If no sync found, return -1 int get_syncoffset(char const* src, int src_size , char const* target, int target_size) const; #endif enum state { #ifndef TORRENT_DISABLE_ENCRYPTION read_pe_dhkey = 0, read_pe_syncvc, read_pe_synchash, read_pe_skey_vc, read_pe_cryptofield, read_pe_pad, read_pe_ia, init_bt_handshake, read_protocol_identifier, #else read_protocol_identifier = 0, #endif read_info_hash, read_peer_id, // handshake complete read_packet_size, read_packet }; #ifndef TORRENT_DISABLE_ENCRYPTION enum { handshake_len = 68, dh_key_len = 96 }; #endif std::string m_client_version; // state of on_receive state m_state; static const message_handler m_message_handler[num_supported_messages]; // this is a queue of ranges that describes // where in the send buffer actual payload // data is located. This is currently // only used to be able to gather statistics // seperately on payload and protocol data. struct range { range(int s, int l) : start(s) , length(l) { TORRENT_ASSERT(s >= 0); TORRENT_ASSERT(l > 0); } int start; int length; }; static bool range_below_zero(const range& r) { return r.start < 0; } std::vector<range> m_payloads; #ifndef TORRENT_DISABLE_EXTENSIONS // the message ID for upload only message // 0 if not supported int m_upload_only_id; char m_reserved_bits[8]; // this is set to true if the handshake from // the peer indicated that it supports the // extension protocol bool m_supports_extensions:1; #endif bool m_supports_dht_port:1; bool m_supports_fast:1; #ifndef TORRENT_DISABLE_ENCRYPTION // this is set to true after the encryption method has been // succesfully negotiated (either plaintext or rc4), to signal // automatic encryption/decryption. bool m_encrypted; // true if rc4, false if plaintext bool m_rc4_encrypted; // used to disconnect peer if sync points are not found within // the maximum number of bytes int m_sync_bytes_read; // hold information about latest allocated send buffer // need to check for non zero (begin, end) for operations with this buffer::interval m_enc_send_buffer; // initialized during write_pe1_2_dhkey, and destroyed on // creation of m_RC4_handler. Cannot reinitialize once // initialized. boost::scoped_ptr<dh_key_exchange> m_dh_key_exchange; // if RC4 is negotiated, this is used for // encryption/decryption during the entire session. Destroyed // if plaintext is selected boost::scoped_ptr<RC4_handler> m_RC4_handler; // (outgoing only) synchronize verification constant with // remote peer, this will hold RC4_decrypt(vc). Destroyed // after the sync step. boost::scoped_array<char> m_sync_vc; // (incoming only) synchronize hash with remote peer, holds // the sync hash (hash("req1",secret)). Destroyed after the // sync step. boost::scoped_ptr<sha1_hash> m_sync_hash; #endif // #ifndef TORRENT_DISABLE_ENCRYPTION #ifdef TORRENT_DEBUG // this is set to true when the client's // bitfield is sent to this peer bool m_sent_bitfield; bool m_in_constructor; bool m_sent_handshake; // the number of bytes in the send buffer // that have been encrypted (only used for // encrypted connections) public: int m_encrypted_bytes; #endif }; } #endif // TORRENT_BT_PEER_CONNECTION_HPP_INCLUDED
; A297445: a(n) = a(n-1) + 9*a(n-2) - 9*a(n-3), where a(0) = 1, a(1) = 5, a(2) = 11. ; 1,5,11,47,101,425,911,3827,8201,34445,73811,310007,664301,2790065,5978711,25110587,53808401,225995285,484275611,2033957567,4358480501,18305618105,39226324511,164750562947,353036920601,1482755066525,3177332285411,13344795598727,28595990568701,120103160388545,257363915118311,1080928443496907,2316275236064801,9728355991472165,20846477124583211,87555203923249487,187618294121248901,787996835309245385,1688564647091240111,7091971517783208467,15197081823821161001,63827743660048876205,136773736414390449011,574449692940439885847,1230963627729514041101,5170047236463958972625,11078672649565626369911,46530425128175630753627,99708053846090637329201,418773826153580676782645,897372484614815735962811,3768964435382226091043807,8076352361533341623665301,33920679918440034819394265,72687171253800074612987711,305286119265960313374548387,654184541284200671516889401,2747575073393642820370935485,5887660871557806043652004611,24728175660542785383338419367,52988947844020254392868041501,222553580944885068450045774305,476900530596182289535812373511,2002982228503965616050411968747,4292104775365640605822311361601,18026840056535690544453707718725,38628942978290765452400802254411,162241560508821214900083369468527,347660486804616889071607220289701,1460174044579390934100750325216745,3128944381241552001644464982607311,13141566401214518406906752926950707,28160499431173968014800184843465801,118274097610930665662160776342556365,253444494880565712133201663591192211 lpb $0 mov $2,$0 sub $0,1 add $1,1 mod $2,2 add $1,$2 mul $1,3 lpe div $1,3 mul $1,2 add $1,1 mov $0,$1
; A052605: Expansion of E.g.f. x*(1-x)/(1-x-x^3). ; Submitted by Jon Maiga ; 0,1,0,0,24,120,720,10080,120960,1451520,21772800,359251200,6227020800,118313395200,2440992153600,53614649088000,1255367393280000,31300493672448000,825906208038912000 mov $1,$0 trn $0,1 seq $0,52557 ; Expansion of e.g.f. (1-x)/(1-x-x^3). mul $0,$1
/* * Seasons Clock Project * * org: 1/10/2015 * auth: Nels "Chip" Pearson * * Target: I2C Demo Board, 20MHz, ATmega164P * * */ .nolist .include "m164pdef.inc" .list .ORG $0000 rjmp RESET .ORG $0002 rjmp trap_intr .ORG $0004 rjmp trap_intr .ORG $0006 rjmp trap_intr .ORG $0008 rjmp trap_intr .ORG $000A rjmp trap_intr .ORG PCI2addr ; 0x0c Pin Change Interrupt Request 2 rjmp trap_intr .ORG $000E rjmp trap_intr .ORG $0010 rjmp trap_intr .ORG OC2Aaddr ; 0x12 Timer/Counter2 Compare Match A rjmp trap_intr .ORG $0014 rjmp trap_intr .ORG $0016 rjmp trap_intr .ORG $0018 rjmp trap_intr .ORG OC1Aaddr ; 0x1a Timer/Counter1 Compare Match A rjmp trap_intr .ORG OC1Baddr ; 0x1c Timer/Counter1 Compare Match B rjmp trap_intr .ORG $001E rjmp trap_intr .ORG OC0Aaddr ; 0x20 Timer/Counter0 Compare Match A rjmp st_tmr0_intr .ORG $0022 rjmp trap_intr .ORG $0024 rjmp trap_intr .ORG $0026 rjmp trap_intr .ORG $0028 rjmp trap_intr .ORG $002A rjmp trap_intr .ORG $002C rjmp trap_intr .ORG $002E rjmp trap_intr .ORG $0030 rjmp trap_intr .ORG $0032 rjmp trap_intr .ORG TWIaddr ; 0x34 2-wire Serial Interface rjmp trap_intr .ORG $0036 rjmp trap_intr .ORG $0038 rjmp trap_intr .ORG $003A rjmp trap_intr .ORG $003C rjmp trap_intr .DSEG main_flag: .BYTE 1 .CSEG RESET: ; setup SP ldi R16, LOW(RAMEND) out spl, R16 ldi R16, HIGH(RAMEND) out sph, R16 ; JTAG disable ldi R16, $80 out MCUCR, R16 out MCUCR, R16 ; clr r16 sts main_flag, r16 call st_init_tmr0 call stepper_init ; set up stepper I/O and state. ; sei ; enable intr ; main_m: ; call stepper_service ; lds r16, stepper_direction cpi r16, STEPPER_DIR_STOP brne m_skip01 lds r16, main_flag tst r16 brne m_skip01 ; inc r16 sts main_flag, r16 ; ldi r16, low(STEPPER_ONE_REVOLUTION) sts stepper_count, r16 ldi r16, high(STEPPER_ONE_REVOLUTION) sts stepper_count+1, r16 ldi r17, STEPPER_DIR_REV call stepper_set_dir ; m_skip01: ; rjmp main_m trap_intr: ; call tb_led3_on rjmp trap_intr // Sys Timer support .include "sys_timers.asm" // Stepper Motor support .include "stepper_motor.asm"
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r15 push %r8 push %r9 push %rcx lea addresses_A_ht+0x69de, %r8 nop nop nop nop nop and $2602, %rcx mov $0x6162636465666768, %r13 movq %r13, %xmm3 movups %xmm3, (%r8) nop nop nop nop nop and %r11, %r11 lea addresses_WC_ht+0xd36, %r14 nop nop nop nop nop xor $48975, %rcx mov $0x6162636465666768, %r15 movq %r15, %xmm2 vmovups %ymm2, (%r14) nop dec %r8 lea addresses_A_ht+0x36de, %rcx nop nop nop nop and $60927, %r8 movb (%rcx), %r11b nop nop nop and %r14, %r14 lea addresses_A_ht+0x1dc6e, %rcx sub %r9, %r9 vmovups (%rcx), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $0, %xmm4, %r11 nop dec %r13 lea addresses_WC_ht+0x26be, %r8 nop nop dec %r15 movups (%r8), %xmm0 vpextrq $1, %xmm0, %r9 and $52911, %rcx pop %rcx pop %r9 pop %r8 pop %r15 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r8 push %rbx push %rcx push %rsi // Faulty Load lea addresses_A+0x1a8be, %rcx clflush (%rcx) nop dec %rbx mov (%rcx), %r10w lea oracles, %r14 and $0xff, %r10 shlq $12, %r10 mov (%r14,%r10,1), %r10 pop %rsi pop %rcx pop %rbx pop %r8 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 16, 'same': False, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; A118297: Start with 22 and repeatedly reverse the digits and add 1 to get the next term. ; 22,23,33,34,44,45,55,56,66,67,77,78,88,89,99,100,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,2,3,4,5,6 mov $2,$0 mov $0,22 lpb $2 seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences). add $0,1 sub $2,1 lpe
.data HelloWorld: .asciz "Hello World!\n" HelloFunction: .asciz "Hello Function!\n" .bss .lcomm StringPointer, 4 .lcomm StringLength, 4 .text .globl _start .type MyFunction, @function MyFunction: # String pointer and len to be added by caller movl $4, %eax movl $1, %ebx movl StringPointer, %ecx movl StringLength, %edx int $0x80 ret _start : nop # Print the Hello World String movl $HelloWorld, StringPointer movl $14, StringLength call MyFunction # Print Hello Function movl $HelloFunction, StringPointer movl $17, StringLength call MyFunction # Exit Routine ExitCall: movl $1, %eax movl $0, %ebx int $0x80
; A056847: Nearest integer to n - sqrt(n). ; 0,0,1,1,2,3,4,4,5,6,7,8,9,9,10,11,12,13,14,15,16,16,17,18,19,20,21,22,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,36,37,38,39,40,41,42,43,44,45,46,47,48,49,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,225,226,227,228,229,230,231,232,233 mov $1,$0 lpb $0 sub $1,1 add $2,2 trn $0,$2 lpe
dnl AMD K7 mpn_popcount, mpn_hamdist -- population count and hamming dnl distance. dnl dnl K7: popcount 5.0 cycles/limb, hamdist 6.0 cycles/limb dnl Copyright (C) 2000 Free Software Foundation, Inc. dnl dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public License as dnl published by the Free Software Foundation; either version 2.1 of the dnl License, or (at your option) any later version. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with the GNU MP Library; see the file COPYING.LIB. If dnl not, write to the Free Software Foundation, Inc., 59 Temple Place - dnl Suite 330, Boston, MA 02111-1307, USA. include(`../config.m4') dnl Only recent versions of gas know psadbw, in particular gas 2.9.1 on dnl FreeBSD 3.3 and 3.4 doesn't recognise it. define(psadbw_mm4_mm0, `ifelse(m4_ifdef_anyof_p(`HAVE_TARGET_CPU_athlon', `HAVE_TARGET_CPU_pentium3'),1, `.byte 0x0f,0xf6,0xc4 C psadbw %mm4, %mm0', `m4_warning(`warning, using simulated and only partly functional psadbw, use for testing only ') C this works enough for the sum of bytes done below, making it C possible to test on an older cpu leal -8(%esp), %esp movq %mm4, (%esp) movq %mm0, %mm4 forloop(i,1,7, ` psrlq $ 8, %mm4 paddb %mm4, %mm0 ') pushl $ 0 pushl $ 0xFF pand (%esp), %mm0 movq 8(%esp), %mm4 leal 16(%esp), %esp ')') C unsigned long mpn_popcount (mp_srcptr src, mp_size_t size); C unsigned long mpn_hamdist (mp_srcptr src, mp_srcptr src2, mp_size_t size); C C The code here is almost certainly not optimal, but is already a 3x speedup C over the generic C code. The main improvement would be to interleave C processing of two qwords in the loop so as to fully exploit the available C execution units, possibly leading to 3.25 c/l (13 cycles for 4 limbs). C C The loop is based on the example "Efficient 64-bit population count using C MMX instructions" in the Athlon Optimization Guide, AMD document 22007, C page 158 of rev E (reference in mpn/x86/k7/README). ifdef(`OPERATION_popcount',, `ifdef(`OPERATION_hamdist',, `m4_error(`Need OPERATION_popcount or OPERATION_hamdist defined ')')') define(HAM, m4_assert_numargs(1) `ifdef(`OPERATION_hamdist',`$1')') define(POP, m4_assert_numargs(1) `ifdef(`OPERATION_popcount',`$1')') HAM(` defframe(PARAM_SIZE, 12) defframe(PARAM_SRC2, 8) defframe(PARAM_SRC, 4) define(M4_function,mpn_hamdist) ') POP(` defframe(PARAM_SIZE, 8) defframe(PARAM_SRC, 4) define(M4_function,mpn_popcount) ') MULFUNC_PROLOGUE(mpn_popcount mpn_hamdist) ifdef(`PIC',,` dnl non-PIC .section .rodata ALIGN(8) define(LS, m4_assert_numargs(1) `LF(M4_function,`$1')') LS(rodata_AAAAAAAAAAAAAAAA): .long 0xAAAAAAAA .long 0xAAAAAAAA LS(rodata_3333333333333333): .long 0x33333333 .long 0x33333333 LS(rodata_0F0F0F0F0F0F0F0F): .long 0x0F0F0F0F .long 0x0F0F0F0F ') .text ALIGN(32) PROLOGUE(M4_function) deflit(`FRAME',0) movl PARAM_SIZE, %ecx orl %ecx, %ecx jz L(zero) ifdef(`PIC',` movl $0xAAAAAAAA, %eax movl $0x33333333, %edx movd %eax, %mm7 movd %edx, %mm6 movl $0x0F0F0F0F, %eax punpckldq %mm7, %mm7 punpckldq %mm6, %mm6 movd %eax, %mm5 movd %edx, %mm4 punpckldq %mm5, %mm5 ',` movq LS(rodata_AAAAAAAAAAAAAAAA), %mm7 movq LS(rodata_3333333333333333), %mm6 movq LS(rodata_0F0F0F0F0F0F0F0F), %mm5 ') pxor %mm4, %mm4 define(REG_AAAAAAAAAAAAAAAA,%mm7) define(REG_3333333333333333,%mm6) define(REG_0F0F0F0F0F0F0F0F,%mm5) define(REG_0000000000000000,%mm4) movl PARAM_SRC, %eax HAM(` movl PARAM_SRC2, %edx') pxor %mm2, %mm2 C total shrl %ecx jnc L(top) movd (%eax,%ecx,8), %mm1 HAM(` movd 0(%edx,%ecx,8), %mm0 pxor %mm0, %mm1 ') orl %ecx, %ecx jmp L(loaded) ALIGN(16) L(top): C eax src C ebx C ecx counter, qwords, decrementing C edx [hamdist] src2 C C mm0 (scratch) C mm1 (scratch) C mm2 total (low dword) C mm3 C mm4 \ C mm5 | special constants C mm6 | C mm7 / movq -8(%eax,%ecx,8), %mm1 HAM(` pxor -8(%edx,%ecx,8), %mm1') decl %ecx L(loaded): movq %mm1, %mm0 pand REG_AAAAAAAAAAAAAAAA, %mm1 psrlq $1, %mm1 psubd %mm1, %mm0 C bit pairs movq %mm0, %mm1 psrlq $2, %mm0 pand REG_3333333333333333, %mm0 pand REG_3333333333333333, %mm1 paddd %mm1, %mm0 C nibbles movq %mm0, %mm1 psrlq $4, %mm0 pand REG_0F0F0F0F0F0F0F0F, %mm0 pand REG_0F0F0F0F0F0F0F0F, %mm1 paddd %mm1, %mm0 C bytes psadbw_mm4_mm0 paddd %mm0, %mm2 C add to total jnz L(top) movd %mm2, %eax emms ret L(zero): movl $0, %eax ret EPILOGUE()
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; ReadMm3.Asm ; ; Abstract: ; ; AsmReadMm3 function ; ; Notes: ; ;------------------------------------------------------------------------------ SECTION .text ;------------------------------------------------------------------------------ ; UINT64 ; EFIAPI ; AsmReadMm3 ( ; VOID ; ); ;------------------------------------------------------------------------------ global ASM_PFX(AsmReadMm3) ASM_PFX(AsmReadMm3): push eax push eax movq [esp], mm3 pop eax pop edx ret
%define ARCH_AARCH64 0 %define ARCH_ALPHA 0 %define ARCH_ARM 0 %define ARCH_AVR32 0 %define ARCH_AVR32_AP 0 %define ARCH_AVR32_UC 0 %define ARCH_BFIN 0 %define ARCH_IA64 0 %define ARCH_M68K 0 %define ARCH_MIPS 0 %define ARCH_MIPS64 0 %define ARCH_PARISC 0 %define ARCH_PPC 0 %define ARCH_PPC64 0 %define ARCH_S390 0 %define ARCH_SH4 0 %define ARCH_SPARC 0 %define ARCH_SPARC64 0 %define ARCH_TILEGX 0 %define ARCH_TILEPRO 0 %define ARCH_TOMI 0 %define ARCH_X86 1 %define ARCH_X86_32 0 %define ARCH_X86_64 1 %define HAVE_ARMV5TE 0 %define HAVE_ARMV6 0 %define HAVE_ARMV6T2 0 %define HAVE_ARMV8 0 %define HAVE_NEON 0 %define HAVE_VFP 0 %define HAVE_VFPV3 0 %define HAVE_SETEND 0 %define HAVE_ALTIVEC 0 %define HAVE_DCBZL 0 %define HAVE_LDBRX 0 %define HAVE_POWER8 0 %define HAVE_PPC4XX 0 %define HAVE_VSX 0 %define HAVE_AESNI 1 %define HAVE_AMD3DNOW 1 %define HAVE_AMD3DNOWEXT 1 %define HAVE_AVX 1 %define HAVE_AVX2 1 %define HAVE_FMA3 1 %define HAVE_FMA4 1 %define HAVE_MMX 1 %define HAVE_MMXEXT 1 %define HAVE_SSE 1 %define HAVE_SSE2 1 %define HAVE_SSE3 1 %define HAVE_SSE4 1 %define HAVE_SSE42 1 %define HAVE_SSSE3 1 %define HAVE_XOP 1 %define HAVE_CPUNOP 1 %define HAVE_I686 1 %define HAVE_MIPSFPU 0 %define HAVE_MIPS32R2 0 %define HAVE_MIPS64R2 0 %define HAVE_MIPS32R6 0 %define HAVE_MIPS64R6 0 %define HAVE_MIPSDSP 0 %define HAVE_MIPSDSPR2 0 %define HAVE_MSA 0 %define HAVE_LOONGSON2 1 %define HAVE_LOONGSON3 1 %define HAVE_MMI 0 %define HAVE_ARMV5TE_EXTERNAL 0 %define HAVE_ARMV6_EXTERNAL 0 %define HAVE_ARMV6T2_EXTERNAL 0 %define HAVE_ARMV8_EXTERNAL 0 %define HAVE_NEON_EXTERNAL 0 %define HAVE_VFP_EXTERNAL 0 %define HAVE_VFPV3_EXTERNAL 0 %define HAVE_SETEND_EXTERNAL 0 %define HAVE_ALTIVEC_EXTERNAL 0 %define HAVE_DCBZL_EXTERNAL 0 %define HAVE_LDBRX_EXTERNAL 0 %define HAVE_POWER8_EXTERNAL 0 %define HAVE_PPC4XX_EXTERNAL 0 %define HAVE_VSX_EXTERNAL 0 %define HAVE_AESNI_EXTERNAL 1 %define HAVE_AMD3DNOW_EXTERNAL 1 %define HAVE_AMD3DNOWEXT_EXTERNAL 1 %define HAVE_AVX_EXTERNAL 1 %define HAVE_AVX2_EXTERNAL 1 %define HAVE_FMA3_EXTERNAL 1 %define HAVE_FMA4_EXTERNAL 1 %define HAVE_MMX_EXTERNAL 1 %define HAVE_MMXEXT_EXTERNAL 1 %define HAVE_SSE_EXTERNAL 1 %define HAVE_SSE2_EXTERNAL 1 %define HAVE_SSE3_EXTERNAL 1 %define HAVE_SSE4_EXTERNAL 1 %define HAVE_SSE42_EXTERNAL 1 %define HAVE_SSSE3_EXTERNAL 1 %define HAVE_XOP_EXTERNAL 1 %define HAVE_CPUNOP_EXTERNAL 0 %define HAVE_I686_EXTERNAL 0 %define HAVE_MIPSFPU_EXTERNAL 0 %define HAVE_MIPS32R2_EXTERNAL 0 %define HAVE_MIPS64R2_EXTERNAL 0 %define HAVE_MIPS32R6_EXTERNAL 0 %define HAVE_MIPS64R6_EXTERNAL 0 %define HAVE_MIPSDSP_EXTERNAL 0 %define HAVE_MIPSDSPR2_EXTERNAL 0 %define HAVE_MSA_EXTERNAL 0 %define HAVE_LOONGSON2_EXTERNAL 0 %define HAVE_LOONGSON3_EXTERNAL 0 %define HAVE_MMI_EXTERNAL 0 %define HAVE_ARMV5TE_INLINE 0 %define HAVE_ARMV6_INLINE 0 %define HAVE_ARMV6T2_INLINE 0 %define HAVE_ARMV8_INLINE 0 %define HAVE_NEON_INLINE 0 %define HAVE_VFP_INLINE 0 %define HAVE_VFPV3_INLINE 0 %define HAVE_SETEND_INLINE 0 %define HAVE_ALTIVEC_INLINE 0 %define HAVE_DCBZL_INLINE 0 %define HAVE_LDBRX_INLINE 0 %define HAVE_POWER8_INLINE 0 %define HAVE_PPC4XX_INLINE 0 %define HAVE_VSX_INLINE 0 %define HAVE_AESNI_INLINE 1 %define HAVE_AMD3DNOW_INLINE 1 %define HAVE_AMD3DNOWEXT_INLINE 1 %define HAVE_AVX_INLINE 1 %define HAVE_AVX2_INLINE 1 %define HAVE_FMA3_INLINE 1 %define HAVE_FMA4_INLINE 1 %define HAVE_MMX_INLINE 1 %define HAVE_MMXEXT_INLINE 1 %define HAVE_SSE_INLINE 1 %define HAVE_SSE2_INLINE 1 %define HAVE_SSE3_INLINE 1 %define HAVE_SSE4_INLINE 1 %define HAVE_SSE42_INLINE 1 %define HAVE_SSSE3_INLINE 1 %define HAVE_XOP_INLINE 1 %define HAVE_CPUNOP_INLINE 0 %define HAVE_I686_INLINE 0 %define HAVE_MIPSFPU_INLINE 0 %define HAVE_MIPS32R2_INLINE 0 %define HAVE_MIPS64R2_INLINE 0 %define HAVE_MIPS32R6_INLINE 0 %define HAVE_MIPS64R6_INLINE 0 %define HAVE_MIPSDSP_INLINE 0 %define HAVE_MIPSDSPR2_INLINE 0 %define HAVE_MSA_INLINE 0 %define HAVE_LOONGSON2_INLINE 0 %define HAVE_LOONGSON3_INLINE 0 %define HAVE_MMI_INLINE 0 %define HAVE_ALIGNED_STACK 1 %define HAVE_FAST_64BIT 1 %define HAVE_FAST_CLZ 1 %define HAVE_FAST_CMOV 1 %define HAVE_LOCAL_ALIGNED_8 1 %define HAVE_LOCAL_ALIGNED_16 1 %define HAVE_LOCAL_ALIGNED_32 1 %define HAVE_SIMD_ALIGN_16 1 %define HAVE_ATOMICS_GCC 1 %define HAVE_ATOMICS_SUNCC 0 %define HAVE_ATOMICS_WIN32 0 %define HAVE_ATOMIC_CAS_PTR 0 %define HAVE_ATOMIC_COMPARE_EXCHANGE 1 %define HAVE_MACHINE_RW_BARRIER 0 %define HAVE_MEMORYBARRIER 0 %define HAVE_MM_EMPTY 1 %define HAVE_RDTSC 0 %define HAVE_SARESTART 1 %define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1 %define HAVE_CABS 0 %define HAVE_CEXP 0 %define HAVE_INLINE_ASM 1 %define HAVE_SYMVER 0 %define HAVE_YASM 1 %define HAVE_BIGENDIAN 0 %define HAVE_FAST_UNALIGNED 1 %define HAVE_INCOMPATIBLE_LIBAV_ABI 0 %define HAVE_ALSA_ASOUNDLIB_H 0 %define HAVE_ALTIVEC_H 0 %define HAVE_ARPA_INET_H 0 %define HAVE_ASM_TYPES_H 1 %define HAVE_CDIO_PARANOIA_H 0 %define HAVE_CDIO_PARANOIA_PARANOIA_H 0 %define HAVE_DEV_BKTR_IOCTL_BT848_H 0 %define HAVE_DEV_BKTR_IOCTL_METEOR_H 0 %define HAVE_DEV_IC_BT8XX_H 0 %define HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H 0 %define HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H 0 %define HAVE_DIRECT_H 0 %define HAVE_DIRENT_H 1 %define HAVE_DLFCN_H 1 %define HAVE_D3D11_H 0 %define HAVE_DXVA_H 0 %define HAVE_ES2_GL_H 0 %define HAVE_GSM_H 0 %define HAVE_IO_H 0 %define HAVE_MACH_MACH_TIME_H 0 %define HAVE_MACHINE_IOCTL_BT848_H 0 %define HAVE_MACHINE_IOCTL_METEOR_H 0 %define HAVE_MALLOC_H 1 %define HAVE_OPENJPEG_2_1_OPENJPEG_H 0 %define HAVE_OPENJPEG_2_0_OPENJPEG_H 0 %define HAVE_OPENJPEG_1_5_OPENJPEG_H 0 %define HAVE_OPENGL_GL3_H 0 %define HAVE_POLL_H 1 %define HAVE_SNDIO_H 0 %define HAVE_SOUNDCARD_H 0 %define HAVE_SYS_MMAN_H 1 %define HAVE_SYS_PARAM_H 1 %define HAVE_SYS_RESOURCE_H 1 %define HAVE_SYS_SELECT_H 1 %define HAVE_SYS_SOUNDCARD_H 0 %define HAVE_SYS_TIME_H 1 %define HAVE_SYS_UN_H 1 %define HAVE_SYS_VIDEOIO_H 0 %define HAVE_TERMIOS_H 1 %define HAVE_UDPLITE_H 0 %define HAVE_UNISTD_H 1 %define HAVE_VALGRIND_VALGRIND_H 0 %define HAVE_WINDOWS_H 0 %define HAVE_WINSOCK2_H 0 %define HAVE_INTRINSICS_NEON 0 %define HAVE_ATANF 1 %define HAVE_ATAN2F 1 %define HAVE_CBRT 1 %define HAVE_CBRTF 1 %define HAVE_COPYSIGN 1 %define HAVE_COSF 1 %define HAVE_ERF 1 %define HAVE_EXP2 1 %define HAVE_EXP2F 1 %define HAVE_EXPF 1 %define HAVE_HYPOT 1 %define HAVE_ISINF 1 %define HAVE_ISNAN 1 %define HAVE_LDEXPF 1 %define HAVE_LLRINT 1 %define HAVE_LLRINTF 1 %define HAVE_LOG2 1 %define HAVE_LOG2F 1 %define HAVE_LOG10F 1 %define HAVE_LRINT 1 %define HAVE_LRINTF 1 %define HAVE_POWF 1 %define HAVE_RINT 1 %define HAVE_ROUND 1 %define HAVE_ROUNDF 1 %define HAVE_SINF 1 %define HAVE_TRUNC 1 %define HAVE_TRUNCF 1 %define HAVE_ACCESS 1 %define HAVE_ALIGNED_MALLOC 0 %define HAVE_ARC4RANDOM 1 %define HAVE_CLOCK_GETTIME 1 %define HAVE_CLOSESOCKET 0 %define HAVE_COMMANDLINETOARGVW 0 %define HAVE_COTASKMEMFREE 0 %define HAVE_CRYPTGENRANDOM 0 %define HAVE_DLOPEN 1 %define HAVE_FCNTL 1 %define HAVE_FLT_LIM 1 %define HAVE_FORK 1 %define HAVE_GETADDRINFO 0 %define HAVE_GETHRTIME 0 %define HAVE_GETOPT 1 %define HAVE_GETPROCESSAFFINITYMASK 0 %define HAVE_GETPROCESSMEMORYINFO 0 %define HAVE_GETPROCESSTIMES 0 %define HAVE_GETRUSAGE 1 %define HAVE_GETSYSTEMTIMEASFILETIME 0 %define HAVE_GETTIMEOFDAY 1 %define HAVE_GLOB 0 %define HAVE_GLXGETPROCADDRESS 0 %define HAVE_GMTIME_R 1 %define HAVE_INET_ATON 0 %define HAVE_ISATTY 1 %define HAVE_JACK_PORT_GET_LATENCY_RANGE 0 %define HAVE_KBHIT 0 %define HAVE_LOCALTIME_R 1 %define HAVE_LSTAT 1 %define HAVE_LZO1X_999_COMPRESS 0 %define HAVE_MACH_ABSOLUTE_TIME 0 %define HAVE_MAPVIEWOFFILE 0 %define HAVE_MEMALIGN 1 %define HAVE_MKSTEMP 1 %define HAVE_MMAP 1 %define HAVE_MPROTECT 1 %define HAVE_NANOSLEEP 1 %define HAVE_PEEKNAMEDPIPE 0 %define HAVE_POSIX_MEMALIGN 1 %define HAVE_PTHREAD_CANCEL 0 %define HAVE_SCHED_GETAFFINITY 1 %define HAVE_SETCONSOLETEXTATTRIBUTE 0 %define HAVE_SETCONSOLECTRLHANDLER 0 %define HAVE_SETMODE 0 %define HAVE_SETRLIMIT 1 %define HAVE_SLEEP 0 %define HAVE_STRERROR_R 1 %define HAVE_SYSCONF 1 %define HAVE_SYSCTL 0 %define HAVE_USLEEP 1 %define HAVE_UTGETOSTYPEFROMSTRING 0 %define HAVE_VIRTUALALLOC 0 %define HAVE_WGLGETPROCADDRESS 0 %define HAVE_PTHREADS 1 %define HAVE_OS2THREADS 0 %define HAVE_W32THREADS 0 %define HAVE_AS_DN_DIRECTIVE 0 %define HAVE_AS_FUNC 0 %define HAVE_AS_OBJECT_ARCH 0 %define HAVE_ASM_MOD_Q 0 %define HAVE_ATTRIBUTE_MAY_ALIAS 1 %define HAVE_ATTRIBUTE_PACKED 1 %define HAVE_EBP_AVAILABLE 1 %define HAVE_EBX_AVAILABLE 1 %define HAVE_GNU_AS 0 %define HAVE_GNU_WINDRES 0 %define HAVE_IBM_ASM 0 %define HAVE_INLINE_ASM_LABELS 1 %define HAVE_INLINE_ASM_NONLOCAL_LABELS 1 %define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1 %define HAVE_PRAGMA_DEPRECATED 1 %define HAVE_RSYNC_CONTIMEOUT 1 %define HAVE_SYMVER_ASM_LABEL 0 %define HAVE_SYMVER_GNU_ASM 1 %define HAVE_VFP_ARGS 0 %define HAVE_XFORM_ASM 0 %define HAVE_XMM_CLOBBERS 1 %define HAVE_CONDITION_VARIABLE_PTR 0 %define HAVE_SOCKLEN_T 0 %define HAVE_STRUCT_ADDRINFO 0 %define HAVE_STRUCT_GROUP_SOURCE_REQ 0 %define HAVE_STRUCT_IP_MREQ_SOURCE 0 %define HAVE_STRUCT_IPV6_MREQ 0 %define HAVE_STRUCT_POLLFD 0 %define HAVE_STRUCT_RUSAGE_RU_MAXRSS 1 %define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0 %define HAVE_STRUCT_SOCKADDR_IN6 0 %define HAVE_STRUCT_SOCKADDR_SA_LEN 0 %define HAVE_STRUCT_SOCKADDR_STORAGE 0 %define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 0 %define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1 %define HAVE_ATOMICS_NATIVE 1 %define HAVE_DOS_PATHS 0 %define HAVE_DXVA2API_COBJ 0 %define HAVE_DXVA2_LIB 0 %define HAVE_WINRT 0 %define HAVE_LIBC_MSVCRT 0 %define HAVE_LIBDC1394_1 0 %define HAVE_LIBDC1394_2 0 %define HAVE_MAKEINFO 1 %define HAVE_MAKEINFO_HTML 1 %define HAVE_PERL 1 %define HAVE_POD2MAN 1 %define HAVE_SDL 0 %define HAVE_SECTION_DATA_REL_RO 1 %define HAVE_TEXI2HTML 0 %define HAVE_THREADS 1 %define HAVE_VAAPI_X11 0 %define HAVE_VDPAU_X11 0 %define HAVE_XLIB 0 %define CONFIG_BSFS 0 %define CONFIG_DECODERS 1 %define CONFIG_ENCODERS 0 %define CONFIG_HWACCELS 0 %define CONFIG_PARSERS 1 %define CONFIG_INDEVS 0 %define CONFIG_OUTDEVS 0 %define CONFIG_FILTERS 0 %define CONFIG_DEMUXERS 1 %define CONFIG_MUXERS 0 %define CONFIG_PROTOCOLS 0 %define CONFIG_DOC 0 %define CONFIG_HTMLPAGES 0 %define CONFIG_MANPAGES 0 %define CONFIG_PODPAGES 0 %define CONFIG_TXTPAGES 0 %define CONFIG_AVIO_READING_EXAMPLE 1 %define CONFIG_AVIO_DIR_CMD_EXAMPLE 1 %define CONFIG_DECODING_ENCODING_EXAMPLE 1 %define CONFIG_DEMUXING_DECODING_EXAMPLE 1 %define CONFIG_EXTRACT_MVS_EXAMPLE 1 %define CONFIG_FILTER_AUDIO_EXAMPLE 0 %define CONFIG_FILTERING_AUDIO_EXAMPLE 0 %define CONFIG_FILTERING_VIDEO_EXAMPLE 0 %define CONFIG_METADATA_EXAMPLE 1 %define CONFIG_MUXING_EXAMPLE 0 %define CONFIG_QSVDEC_EXAMPLE 0 %define CONFIG_REMUXING_EXAMPLE 1 %define CONFIG_RESAMPLING_AUDIO_EXAMPLE 0 %define CONFIG_SCALING_VIDEO_EXAMPLE 0 %define CONFIG_TRANSCODE_AAC_EXAMPLE 0 %define CONFIG_TRANSCODING_EXAMPLE 0 %define CONFIG_AVISYNTH 0 %define CONFIG_BZLIB 0 %define CONFIG_CHROMAPRINT 0 %define CONFIG_CRYSTALHD 0 %define CONFIG_DECKLINK 0 %define CONFIG_FREI0R 0 %define CONFIG_GCRYPT 0 %define CONFIG_GMP 0 %define CONFIG_GNUTLS 0 %define CONFIG_ICONV 0 %define CONFIG_LADSPA 0 %define CONFIG_LIBAACPLUS 0 %define CONFIG_LIBASS 0 %define CONFIG_LIBBLURAY 0 %define CONFIG_LIBBS2B 0 %define CONFIG_LIBCACA 0 %define CONFIG_LIBCDIO 0 %define CONFIG_LIBCELT 0 %define CONFIG_LIBDC1394 0 %define CONFIG_LIBDCADEC 0 %define CONFIG_LIBFAAC 0 %define CONFIG_LIBFDK_AAC 0 %define CONFIG_LIBFLITE 0 %define CONFIG_LIBFONTCONFIG 0 %define CONFIG_LIBFREETYPE 0 %define CONFIG_LIBFRIBIDI 0 %define CONFIG_LIBGME 0 %define CONFIG_LIBGSM 0 %define CONFIG_LIBIEC61883 0 %define CONFIG_LIBILBC 0 %define CONFIG_LIBKVAZAAR 0 %define CONFIG_LIBMFX 0 %define CONFIG_LIBMODPLUG 0 %define CONFIG_LIBMP3LAME 0 %define CONFIG_LIBNUT 0 %define CONFIG_LIBOPENCORE_AMRNB 0 %define CONFIG_LIBOPENCORE_AMRWB 0 %define CONFIG_LIBOPENCV 0 %define CONFIG_LIBOPENH264 0 %define CONFIG_LIBOPENJPEG 0 %define CONFIG_LIBOPUS 0 %define CONFIG_LIBPULSE 0 %define CONFIG_LIBQUVI 0 %define CONFIG_LIBRTMP 0 %define CONFIG_LIBRUBBERBAND 0 %define CONFIG_LIBSCHROEDINGER 0 %define CONFIG_LIBSHINE 0 %define CONFIG_LIBSMBCLIENT 0 %define CONFIG_LIBSNAPPY 0 %define CONFIG_LIBSOXR 0 %define CONFIG_LIBSPEEX 0 %define CONFIG_LIBSSH 0 %define CONFIG_LIBTESSERACT 0 %define CONFIG_LIBTHEORA 0 %define CONFIG_LIBTWOLAME 0 %define CONFIG_LIBUTVIDEO 0 %define CONFIG_LIBV4L2 0 %define CONFIG_LIBVIDSTAB 0 %define CONFIG_LIBVO_AACENC 0 %define CONFIG_LIBVO_AMRWBENC 0 %define CONFIG_LIBVORBIS 0 %define CONFIG_LIBVPX 0 %define CONFIG_LIBWAVPACK 0 %define CONFIG_LIBWEBP 0 %define CONFIG_LIBX264 0 %define CONFIG_LIBX265 0 %define CONFIG_LIBXAVS 0 %define CONFIG_LIBXCB 0 %define CONFIG_LIBXCB_SHM 0 %define CONFIG_LIBXCB_SHAPE 0 %define CONFIG_LIBXCB_XFIXES 0 %define CONFIG_LIBXVID 0 %define CONFIG_LIBZIMG 0 %define CONFIG_LIBZMQ 0 %define CONFIG_LIBZVBI 0 %define CONFIG_LZMA 0 %define CONFIG_MMAL 0 %define CONFIG_NETCDF 0 %define CONFIG_NVENC 0 %define CONFIG_OPENAL 0 %define CONFIG_OPENCL 0 %define CONFIG_OPENGL 0 %define CONFIG_OPENSSL 0 %define CONFIG_SCHANNEL 0 %define CONFIG_SDL 0 %define CONFIG_SECURETRANSPORT 0 %define CONFIG_X11GRAB 0 %define CONFIG_XLIB 0 %define CONFIG_ZLIB 0 %define CONFIG_FTRAPV 0 %define CONFIG_GRAY 0 %define CONFIG_HARDCODED_TABLES 0 %define CONFIG_RUNTIME_CPUDETECT 1 %define CONFIG_SAFE_BITSTREAM_READER 1 %define CONFIG_SHARED 0 %define CONFIG_SMALL 1 %define CONFIG_STATIC 1 %define CONFIG_SWSCALE_ALPHA 1 %define CONFIG_D3D11VA 0 %define CONFIG_DXVA2 0 %define CONFIG_VAAPI 0 %define CONFIG_VDA 0 %define CONFIG_VDPAU 0 %define CONFIG_VIDEOTOOLBOX 0 %define CONFIG_XVMC 0 %define CONFIG_GPL 0 %define CONFIG_NONFREE 0 %define CONFIG_VERSION3 0 %define CONFIG_AVCODEC 1 %define CONFIG_AVDEVICE 0 %define CONFIG_AVFILTER 0 %define CONFIG_AVFORMAT 1 %define CONFIG_AVRESAMPLE 0 %define CONFIG_AVUTIL 1 %define CONFIG_POSTPROC 0 %define CONFIG_SWRESAMPLE 0 %define CONFIG_SWSCALE 0 %define CONFIG_FFPLAY 0 %define CONFIG_FFPROBE 0 %define CONFIG_FFSERVER 0 %define CONFIG_FFMPEG 0 %define CONFIG_DCT 1 %define CONFIG_DWT 0 %define CONFIG_ERROR_RESILIENCE 0 %define CONFIG_FAAN 1 %define CONFIG_FAST_UNALIGNED 1 %define CONFIG_FFT 1 %define CONFIG_LSP 0 %define CONFIG_LZO 0 %define CONFIG_MDCT 1 %define CONFIG_PIXELUTILS 0 %define CONFIG_NETWORK 0 %define CONFIG_RDFT 1 %define CONFIG_FONTCONFIG 0 %define CONFIG_INCOMPATIBLE_LIBAV_ABI 0 %define CONFIG_MEMALIGN_HACK 0 %define CONFIG_MEMORY_POISONING 0 %define CONFIG_NEON_CLOBBER_TEST 0 %define CONFIG_PIC 1 %define CONFIG_POD2MAN 1 %define CONFIG_RAISE_MAJOR 0 %define CONFIG_THUMB 0 %define CONFIG_VALGRIND_BACKTRACE 0 %define CONFIG_XMM_CLOBBER_TEST 0 %define CONFIG_AANDCTTABLES 0 %define CONFIG_AC3DSP 0 %define CONFIG_AUDIO_FRAME_QUEUE 0 %define CONFIG_AUDIODSP 0 %define CONFIG_BLOCKDSP 0 %define CONFIG_BSWAPDSP 0 %define CONFIG_CABAC 0 %define CONFIG_DIRAC_PARSE 1 %define CONFIG_DVPROFILE 0 %define CONFIG_EXIF 0 %define CONFIG_FAANDCT 0 %define CONFIG_FAANIDCT 0 %define CONFIG_FDCTDSP 0 %define CONFIG_FLACDSP 0 %define CONFIG_FMTCONVERT 0 %define CONFIG_FRAME_THREAD_ENCODER 0 %define CONFIG_G722DSP 0 %define CONFIG_GOLOMB 1 %define CONFIG_GPLV3 0 %define CONFIG_H263DSP 0 %define CONFIG_H264CHROMA 0 %define CONFIG_H264DSP 0 %define CONFIG_H264PRED 0 %define CONFIG_H264QPEL 0 %define CONFIG_HPELDSP 0 %define CONFIG_HUFFMAN 0 %define CONFIG_HUFFYUVDSP 0 %define CONFIG_HUFFYUVENCDSP 0 %define CONFIG_IDCTDSP 0 %define CONFIG_IIRFILTER 0 %define CONFIG_IMDCT15 1 %define CONFIG_INTRAX8 0 %define CONFIG_IVIDSP 0 %define CONFIG_JPEGTABLES 0 %define CONFIG_LIBX262 0 %define CONFIG_LGPLV3 0 %define CONFIG_LLAUDDSP 0 %define CONFIG_LLVIDDSP 0 %define CONFIG_LPC 0 %define CONFIG_LZF 0 %define CONFIG_ME_CMP 0 %define CONFIG_MPEG_ER 0 %define CONFIG_MPEGAUDIO 1 %define CONFIG_MPEGAUDIODSP 1 %define CONFIG_MPEGVIDEO 0 %define CONFIG_MPEGVIDEOENC 0 %define CONFIG_MSS34DSP 0 %define CONFIG_PIXBLOCKDSP 0 %define CONFIG_QPELDSP 0 %define CONFIG_QSV 0 %define CONFIG_QSVDEC 0 %define CONFIG_QSVENC 0 %define CONFIG_RANGECODER 0 %define CONFIG_RIFFDEC 1 %define CONFIG_RIFFENC 0 %define CONFIG_RTPDEC 0 %define CONFIG_RTPENC_CHAIN 0 %define CONFIG_RV34DSP 0 %define CONFIG_SINEWIN 1 %define CONFIG_SNAPPY 0 %define CONFIG_STARTCODE 0 %define CONFIG_TEXTUREDSP 0 %define CONFIG_TEXTUREDSPENC 0 %define CONFIG_TPELDSP 0 %define CONFIG_VIDEODSP 0 %define CONFIG_VP3DSP 0 %define CONFIG_VP56DSP 0 %define CONFIG_VP8DSP 0 %define CONFIG_WMA_FREQS 0 %define CONFIG_WMV2DSP 0 %define CONFIG_AAC_ADTSTOASC_BSF 0 %define CONFIG_CHOMP_BSF 0 %define CONFIG_DUMP_EXTRADATA_BSF 0 %define CONFIG_H264_MP4TOANNEXB_BSF 0 %define CONFIG_HEVC_MP4TOANNEXB_BSF 0 %define CONFIG_IMX_DUMP_HEADER_BSF 0 %define CONFIG_MJPEG2JPEG_BSF 0 %define CONFIG_MJPEGA_DUMP_HEADER_BSF 0 %define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0 %define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0 %define CONFIG_MOV2TEXTSUB_BSF 0 %define CONFIG_NOISE_BSF 0 %define CONFIG_REMOVE_EXTRADATA_BSF 0 %define CONFIG_TEXT2MOVSUB_BSF 0 %define CONFIG_AASC_DECODER 0 %define CONFIG_AIC_DECODER 0 %define CONFIG_ALIAS_PIX_DECODER 0 %define CONFIG_AMV_DECODER 0 %define CONFIG_ANM_DECODER 0 %define CONFIG_ANSI_DECODER 0 %define CONFIG_APNG_DECODER 0 %define CONFIG_ASV1_DECODER 0 %define CONFIG_ASV2_DECODER 0 %define CONFIG_AURA_DECODER 0 %define CONFIG_AURA2_DECODER 0 %define CONFIG_AVRP_DECODER 0 %define CONFIG_AVRN_DECODER 0 %define CONFIG_AVS_DECODER 0 %define CONFIG_AVUI_DECODER 0 %define CONFIG_AYUV_DECODER 0 %define CONFIG_BETHSOFTVID_DECODER 0 %define CONFIG_BFI_DECODER 0 %define CONFIG_BINK_DECODER 0 %define CONFIG_BMP_DECODER 0 %define CONFIG_BMV_VIDEO_DECODER 0 %define CONFIG_BRENDER_PIX_DECODER 0 %define CONFIG_C93_DECODER 0 %define CONFIG_CAVS_DECODER 0 %define CONFIG_CDGRAPHICS_DECODER 0 %define CONFIG_CDXL_DECODER 0 %define CONFIG_CINEPAK_DECODER 0 %define CONFIG_CLJR_DECODER 0 %define CONFIG_CLLC_DECODER 0 %define CONFIG_COMFORTNOISE_DECODER 0 %define CONFIG_CPIA_DECODER 0 %define CONFIG_CSCD_DECODER 0 %define CONFIG_CYUV_DECODER 0 %define CONFIG_DDS_DECODER 0 %define CONFIG_DFA_DECODER 0 %define CONFIG_DIRAC_DECODER 0 %define CONFIG_DNXHD_DECODER 0 %define CONFIG_DPX_DECODER 0 %define CONFIG_DSICINVIDEO_DECODER 0 %define CONFIG_DVVIDEO_DECODER 0 %define CONFIG_DXA_DECODER 0 %define CONFIG_DXTORY_DECODER 0 %define CONFIG_DXV_DECODER 0 %define CONFIG_EACMV_DECODER 0 %define CONFIG_EAMAD_DECODER 0 %define CONFIG_EATGQ_DECODER 0 %define CONFIG_EATGV_DECODER 0 %define CONFIG_EATQI_DECODER 0 %define CONFIG_EIGHTBPS_DECODER 0 %define CONFIG_EIGHTSVX_EXP_DECODER 0 %define CONFIG_EIGHTSVX_FIB_DECODER 0 %define CONFIG_ESCAPE124_DECODER 0 %define CONFIG_ESCAPE130_DECODER 0 %define CONFIG_EXR_DECODER 0 %define CONFIG_FFV1_DECODER 0 %define CONFIG_FFVHUFF_DECODER 0 %define CONFIG_FIC_DECODER 0 %define CONFIG_FLASHSV_DECODER 0 %define CONFIG_FLASHSV2_DECODER 0 %define CONFIG_FLIC_DECODER 0 %define CONFIG_FLV_DECODER 0 %define CONFIG_FOURXM_DECODER 0 %define CONFIG_FRAPS_DECODER 0 %define CONFIG_FRWU_DECODER 0 %define CONFIG_G2M_DECODER 0 %define CONFIG_GIF_DECODER 0 %define CONFIG_H261_DECODER 0 %define CONFIG_H263_DECODER 0 %define CONFIG_H263I_DECODER 0 %define CONFIG_H263P_DECODER 0 %define CONFIG_H264_DECODER 0 %define CONFIG_H264_CRYSTALHD_DECODER 0 %define CONFIG_H264_MMAL_DECODER 0 %define CONFIG_H264_QSV_DECODER 0 %define CONFIG_H264_VDA_DECODER 0 %define CONFIG_H264_VDPAU_DECODER 0 %define CONFIG_HAP_DECODER 0 %define CONFIG_HEVC_DECODER 0 %define CONFIG_HEVC_QSV_DECODER 0 %define CONFIG_HNM4_VIDEO_DECODER 0 %define CONFIG_HQ_HQA_DECODER 0 %define CONFIG_HQX_DECODER 0 %define CONFIG_HUFFYUV_DECODER 0 %define CONFIG_IDCIN_DECODER 0 %define CONFIG_IFF_ILBM_DECODER 0 %define CONFIG_INDEO2_DECODER 0 %define CONFIG_INDEO3_DECODER 0 %define CONFIG_INDEO4_DECODER 0 %define CONFIG_INDEO5_DECODER 0 %define CONFIG_INTERPLAY_VIDEO_DECODER 0 %define CONFIG_JPEG2000_DECODER 0 %define CONFIG_JPEGLS_DECODER 0 %define CONFIG_JV_DECODER 0 %define CONFIG_KGV1_DECODER 0 %define CONFIG_KMVC_DECODER 0 %define CONFIG_LAGARITH_DECODER 0 %define CONFIG_LOCO_DECODER 0 %define CONFIG_MDEC_DECODER 0 %define CONFIG_MIMIC_DECODER 0 %define CONFIG_MJPEG_DECODER 0 %define CONFIG_MJPEGB_DECODER 0 %define CONFIG_MMVIDEO_DECODER 0 %define CONFIG_MOTIONPIXELS_DECODER 0 %define CONFIG_MPEG_XVMC_DECODER 0 %define CONFIG_MPEG1VIDEO_DECODER 0 %define CONFIG_MPEG2VIDEO_DECODER 0 %define CONFIG_MPEG4_DECODER 0 %define CONFIG_MPEG4_CRYSTALHD_DECODER 0 %define CONFIG_MPEG4_VDPAU_DECODER 0 %define CONFIG_MPEGVIDEO_DECODER 0 %define CONFIG_MPEG_VDPAU_DECODER 0 %define CONFIG_MPEG1_VDPAU_DECODER 0 %define CONFIG_MPEG2_MMAL_DECODER 0 %define CONFIG_MPEG2_CRYSTALHD_DECODER 0 %define CONFIG_MPEG2_QSV_DECODER 0 %define CONFIG_MSA1_DECODER 0 %define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0 %define CONFIG_MSMPEG4V1_DECODER 0 %define CONFIG_MSMPEG4V2_DECODER 0 %define CONFIG_MSMPEG4V3_DECODER 0 %define CONFIG_MSRLE_DECODER 0 %define CONFIG_MSS1_DECODER 0 %define CONFIG_MSS2_DECODER 0 %define CONFIG_MSVIDEO1_DECODER 0 %define CONFIG_MSZH_DECODER 0 %define CONFIG_MTS2_DECODER 0 %define CONFIG_MVC1_DECODER 0 %define CONFIG_MVC2_DECODER 0 %define CONFIG_MXPEG_DECODER 0 %define CONFIG_NUV_DECODER 0 %define CONFIG_PAF_VIDEO_DECODER 0 %define CONFIG_PAM_DECODER 0 %define CONFIG_PBM_DECODER 0 %define CONFIG_PCX_DECODER 0 %define CONFIG_PGM_DECODER 0 %define CONFIG_PGMYUV_DECODER 0 %define CONFIG_PICTOR_DECODER 0 %define CONFIG_PNG_DECODER 0 %define CONFIG_PPM_DECODER 0 %define CONFIG_PRORES_DECODER 0 %define CONFIG_PRORES_LGPL_DECODER 0 %define CONFIG_PTX_DECODER 0 %define CONFIG_QDRAW_DECODER 0 %define CONFIG_QPEG_DECODER 0 %define CONFIG_QTRLE_DECODER 0 %define CONFIG_R10K_DECODER 0 %define CONFIG_R210_DECODER 0 %define CONFIG_RAWVIDEO_DECODER 0 %define CONFIG_RL2_DECODER 0 %define CONFIG_ROQ_DECODER 0 %define CONFIG_RPZA_DECODER 0 %define CONFIG_RSCC_DECODER 0 %define CONFIG_RV10_DECODER 0 %define CONFIG_RV20_DECODER 0 %define CONFIG_RV30_DECODER 0 %define CONFIG_RV40_DECODER 0 %define CONFIG_S302M_DECODER 0 %define CONFIG_SANM_DECODER 0 %define CONFIG_SCREENPRESSO_DECODER 0 %define CONFIG_SDX2_DPCM_DECODER 0 %define CONFIG_SGI_DECODER 0 %define CONFIG_SGIRLE_DECODER 0 %define CONFIG_SMACKER_DECODER 0 %define CONFIG_SMC_DECODER 0 %define CONFIG_SMVJPEG_DECODER 0 %define CONFIG_SNOW_DECODER 0 %define CONFIG_SP5X_DECODER 0 %define CONFIG_SUNRAST_DECODER 0 %define CONFIG_SVQ1_DECODER 0 %define CONFIG_SVQ3_DECODER 0 %define CONFIG_TARGA_DECODER 0 %define CONFIG_TARGA_Y216_DECODER 0 %define CONFIG_TDSC_DECODER 0 %define CONFIG_THEORA_DECODER 0 %define CONFIG_THP_DECODER 0 %define CONFIG_TIERTEXSEQVIDEO_DECODER 0 %define CONFIG_TIFF_DECODER 0 %define CONFIG_TMV_DECODER 0 %define CONFIG_TRUEMOTION1_DECODER 0 %define CONFIG_TRUEMOTION2_DECODER 0 %define CONFIG_TSCC_DECODER 0 %define CONFIG_TSCC2_DECODER 0 %define CONFIG_TXD_DECODER 0 %define CONFIG_ULTI_DECODER 0 %define CONFIG_UTVIDEO_DECODER 0 %define CONFIG_V210_DECODER 0 %define CONFIG_V210X_DECODER 0 %define CONFIG_V308_DECODER 0 %define CONFIG_V408_DECODER 0 %define CONFIG_V410_DECODER 0 %define CONFIG_VB_DECODER 0 %define CONFIG_VBLE_DECODER 0 %define CONFIG_VC1_DECODER 0 %define CONFIG_VC1_CRYSTALHD_DECODER 0 %define CONFIG_VC1_VDPAU_DECODER 0 %define CONFIG_VC1IMAGE_DECODER 0 %define CONFIG_VC1_MMAL_DECODER 0 %define CONFIG_VC1_QSV_DECODER 0 %define CONFIG_VCR1_DECODER 0 %define CONFIG_VMDVIDEO_DECODER 0 %define CONFIG_VMNC_DECODER 0 %define CONFIG_VP3_DECODER 0 %define CONFIG_VP5_DECODER 0 %define CONFIG_VP6_DECODER 0 %define CONFIG_VP6A_DECODER 0 %define CONFIG_VP6F_DECODER 0 %define CONFIG_VP7_DECODER 0 %define CONFIG_VP8_DECODER 0 %define CONFIG_VP9_DECODER 0 %define CONFIG_VQA_DECODER 0 %define CONFIG_WEBP_DECODER 0 %define CONFIG_WMV1_DECODER 0 %define CONFIG_WMV2_DECODER 0 %define CONFIG_WMV3_DECODER 0 %define CONFIG_WMV3_CRYSTALHD_DECODER 0 %define CONFIG_WMV3_VDPAU_DECODER 0 %define CONFIG_WMV3IMAGE_DECODER 0 %define CONFIG_WNV1_DECODER 0 %define CONFIG_XAN_WC3_DECODER 0 %define CONFIG_XAN_WC4_DECODER 0 %define CONFIG_XBM_DECODER 0 %define CONFIG_XFACE_DECODER 0 %define CONFIG_XL_DECODER 0 %define CONFIG_XWD_DECODER 0 %define CONFIG_Y41P_DECODER 0 %define CONFIG_YOP_DECODER 0 %define CONFIG_YUV4_DECODER 0 %define CONFIG_ZERO12V_DECODER 0 %define CONFIG_ZEROCODEC_DECODER 0 %define CONFIG_ZLIB_DECODER 0 %define CONFIG_ZMBV_DECODER 0 %define CONFIG_AAC_DECODER 1 %define CONFIG_AAC_FIXED_DECODER 0 %define CONFIG_AAC_LATM_DECODER 0 %define CONFIG_AC3_DECODER 0 %define CONFIG_AC3_FIXED_DECODER 0 %define CONFIG_ALAC_DECODER 0 %define CONFIG_ALS_DECODER 0 %define CONFIG_AMRNB_DECODER 0 %define CONFIG_AMRWB_DECODER 0 %define CONFIG_APE_DECODER 0 %define CONFIG_ATRAC1_DECODER 0 %define CONFIG_ATRAC3_DECODER 0 %define CONFIG_ATRAC3P_DECODER 0 %define CONFIG_BINKAUDIO_DCT_DECODER 0 %define CONFIG_BINKAUDIO_RDFT_DECODER 0 %define CONFIG_BMV_AUDIO_DECODER 0 %define CONFIG_COOK_DECODER 0 %define CONFIG_DCA_DECODER 0 %define CONFIG_DSD_LSBF_DECODER 0 %define CONFIG_DSD_MSBF_DECODER 0 %define CONFIG_DSD_LSBF_PLANAR_DECODER 0 %define CONFIG_DSD_MSBF_PLANAR_DECODER 0 %define CONFIG_DSICINAUDIO_DECODER 0 %define CONFIG_DSS_SP_DECODER 0 %define CONFIG_EAC3_DECODER 0 %define CONFIG_EVRC_DECODER 0 %define CONFIG_FFWAVESYNTH_DECODER 0 %define CONFIG_FLAC_DECODER 0 %define CONFIG_G723_1_DECODER 0 %define CONFIG_G729_DECODER 0 %define CONFIG_GSM_DECODER 0 %define CONFIG_GSM_MS_DECODER 0 %define CONFIG_IAC_DECODER 0 %define CONFIG_IMC_DECODER 0 %define CONFIG_INTERPLAY_ACM_DECODER 0 %define CONFIG_MACE3_DECODER 0 %define CONFIG_MACE6_DECODER 0 %define CONFIG_METASOUND_DECODER 0 %define CONFIG_MLP_DECODER 0 %define CONFIG_MP1_DECODER 0 %define CONFIG_MP1FLOAT_DECODER 0 %define CONFIG_MP2_DECODER 0 %define CONFIG_MP2FLOAT_DECODER 0 %define CONFIG_MP3_DECODER 1 %define CONFIG_MP3FLOAT_DECODER 0 %define CONFIG_MP3ADU_DECODER 0 %define CONFIG_MP3ADUFLOAT_DECODER 0 %define CONFIG_MP3ON4_DECODER 0 %define CONFIG_MP3ON4FLOAT_DECODER 0 %define CONFIG_MPC7_DECODER 0 %define CONFIG_MPC8_DECODER 0 %define CONFIG_NELLYMOSER_DECODER 0 %define CONFIG_ON2AVC_DECODER 0 %define CONFIG_OPUS_DECODER 0 %define CONFIG_PAF_AUDIO_DECODER 0 %define CONFIG_QCELP_DECODER 0 %define CONFIG_QDM2_DECODER 0 %define CONFIG_RA_144_DECODER 0 %define CONFIG_RA_288_DECODER 0 %define CONFIG_RALF_DECODER 0 %define CONFIG_SHORTEN_DECODER 0 %define CONFIG_SIPR_DECODER 0 %define CONFIG_SMACKAUD_DECODER 0 %define CONFIG_SONIC_DECODER 0 %define CONFIG_TAK_DECODER 0 %define CONFIG_TRUEHD_DECODER 0 %define CONFIG_TRUESPEECH_DECODER 0 %define CONFIG_TTA_DECODER 0 %define CONFIG_TWINVQ_DECODER 0 %define CONFIG_VMDAUDIO_DECODER 0 %define CONFIG_VORBIS_DECODER 1 %define CONFIG_WAVPACK_DECODER 0 %define CONFIG_WMALOSSLESS_DECODER 0 %define CONFIG_WMAPRO_DECODER 0 %define CONFIG_WMAV1_DECODER 0 %define CONFIG_WMAV2_DECODER 0 %define CONFIG_WMAVOICE_DECODER 0 %define CONFIG_WS_SND1_DECODER 0 %define CONFIG_XMA1_DECODER 0 %define CONFIG_XMA2_DECODER 0 %define CONFIG_PCM_ALAW_DECODER 1 %define CONFIG_PCM_BLURAY_DECODER 0 %define CONFIG_PCM_DVD_DECODER 0 %define CONFIG_PCM_F32BE_DECODER 0 %define CONFIG_PCM_F32LE_DECODER 1 %define CONFIG_PCM_F64BE_DECODER 0 %define CONFIG_PCM_F64LE_DECODER 0 %define CONFIG_PCM_LXF_DECODER 0 %define CONFIG_PCM_MULAW_DECODER 1 %define CONFIG_PCM_S8_DECODER 0 %define CONFIG_PCM_S8_PLANAR_DECODER 0 %define CONFIG_PCM_S16BE_DECODER 1 %define CONFIG_PCM_S16BE_PLANAR_DECODER 0 %define CONFIG_PCM_S16LE_DECODER 1 %define CONFIG_PCM_S16LE_PLANAR_DECODER 0 %define CONFIG_PCM_S24BE_DECODER 1 %define CONFIG_PCM_S24DAUD_DECODER 0 %define CONFIG_PCM_S24LE_DECODER 1 %define CONFIG_PCM_S24LE_PLANAR_DECODER 0 %define CONFIG_PCM_S32BE_DECODER 0 %define CONFIG_PCM_S32LE_DECODER 1 %define CONFIG_PCM_S32LE_PLANAR_DECODER 0 %define CONFIG_PCM_U8_DECODER 1 %define CONFIG_PCM_U16BE_DECODER 0 %define CONFIG_PCM_U16LE_DECODER 0 %define CONFIG_PCM_U24BE_DECODER 0 %define CONFIG_PCM_U24LE_DECODER 0 %define CONFIG_PCM_U32BE_DECODER 0 %define CONFIG_PCM_U32LE_DECODER 0 %define CONFIG_PCM_ZORK_DECODER 0 %define CONFIG_INTERPLAY_DPCM_DECODER 0 %define CONFIG_ROQ_DPCM_DECODER 0 %define CONFIG_SOL_DPCM_DECODER 0 %define CONFIG_XAN_DPCM_DECODER 0 %define CONFIG_ADPCM_4XM_DECODER 0 %define CONFIG_ADPCM_ADX_DECODER 0 %define CONFIG_ADPCM_AFC_DECODER 0 %define CONFIG_ADPCM_AICA_DECODER 0 %define CONFIG_ADPCM_CT_DECODER 0 %define CONFIG_ADPCM_DTK_DECODER 0 %define CONFIG_ADPCM_EA_DECODER 0 %define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0 %define CONFIG_ADPCM_EA_R1_DECODER 0 %define CONFIG_ADPCM_EA_R2_DECODER 0 %define CONFIG_ADPCM_EA_R3_DECODER 0 %define CONFIG_ADPCM_EA_XAS_DECODER 0 %define CONFIG_ADPCM_G722_DECODER 0 %define CONFIG_ADPCM_G726_DECODER 0 %define CONFIG_ADPCM_G726LE_DECODER 0 %define CONFIG_ADPCM_IMA_AMV_DECODER 0 %define CONFIG_ADPCM_IMA_APC_DECODER 0 %define CONFIG_ADPCM_IMA_DK3_DECODER 0 %define CONFIG_ADPCM_IMA_DK4_DECODER 0 %define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0 %define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0 %define CONFIG_ADPCM_IMA_ISS_DECODER 0 %define CONFIG_ADPCM_IMA_OKI_DECODER 0 %define CONFIG_ADPCM_IMA_QT_DECODER 0 %define CONFIG_ADPCM_IMA_RAD_DECODER 0 %define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0 %define CONFIG_ADPCM_IMA_WAV_DECODER 0 %define CONFIG_ADPCM_IMA_WS_DECODER 0 %define CONFIG_ADPCM_MS_DECODER 0 %define CONFIG_ADPCM_PSX_DECODER 0 %define CONFIG_ADPCM_SBPRO_2_DECODER 0 %define CONFIG_ADPCM_SBPRO_3_DECODER 0 %define CONFIG_ADPCM_SBPRO_4_DECODER 0 %define CONFIG_ADPCM_SWF_DECODER 0 %define CONFIG_ADPCM_THP_DECODER 0 %define CONFIG_ADPCM_THP_LE_DECODER 0 %define CONFIG_ADPCM_VIMA_DECODER 0 %define CONFIG_ADPCM_XA_DECODER 0 %define CONFIG_ADPCM_YAMAHA_DECODER 0 %define CONFIG_SSA_DECODER 0 %define CONFIG_ASS_DECODER 0 %define CONFIG_CCAPTION_DECODER 0 %define CONFIG_DVBSUB_DECODER 0 %define CONFIG_DVDSUB_DECODER 0 %define CONFIG_JACOSUB_DECODER 0 %define CONFIG_MICRODVD_DECODER 0 %define CONFIG_MOVTEXT_DECODER 0 %define CONFIG_MPL2_DECODER 0 %define CONFIG_PGSSUB_DECODER 0 %define CONFIG_PJS_DECODER 0 %define CONFIG_REALTEXT_DECODER 0 %define CONFIG_SAMI_DECODER 0 %define CONFIG_SRT_DECODER 0 %define CONFIG_STL_DECODER 0 %define CONFIG_SUBRIP_DECODER 0 %define CONFIG_SUBVIEWER_DECODER 0 %define CONFIG_SUBVIEWER1_DECODER 0 %define CONFIG_TEXT_DECODER 0 %define CONFIG_VPLAYER_DECODER 0 %define CONFIG_WEBVTT_DECODER 0 %define CONFIG_XSUB_DECODER 0 %define CONFIG_LIBCELT_DECODER 0 %define CONFIG_LIBDCADEC_DECODER 0 %define CONFIG_LIBFDK_AAC_DECODER 0 %define CONFIG_LIBGSM_DECODER 0 %define CONFIG_LIBGSM_MS_DECODER 0 %define CONFIG_LIBILBC_DECODER 0 %define CONFIG_LIBOPENCORE_AMRNB_DECODER 0 %define CONFIG_LIBOPENCORE_AMRWB_DECODER 0 %define CONFIG_LIBOPENJPEG_DECODER 0 %define CONFIG_LIBOPUS_DECODER 0 %define CONFIG_LIBSCHROEDINGER_DECODER 0 %define CONFIG_LIBSPEEX_DECODER 0 %define CONFIG_LIBUTVIDEO_DECODER 0 %define CONFIG_LIBVORBIS_DECODER 0 %define CONFIG_LIBVPX_VP8_DECODER 0 %define CONFIG_LIBVPX_VP9_DECODER 0 %define CONFIG_LIBZVBI_TELETEXT_DECODER 0 %define CONFIG_BINTEXT_DECODER 0 %define CONFIG_XBIN_DECODER 0 %define CONFIG_IDF_DECODER 0 %define CONFIG_AA_DEMUXER 0 %define CONFIG_AAC_DEMUXER 1 %define CONFIG_AC3_DEMUXER 0 %define CONFIG_ACM_DEMUXER 0 %define CONFIG_ACT_DEMUXER 0 %define CONFIG_ADF_DEMUXER 0 %define CONFIG_ADP_DEMUXER 0 %define CONFIG_ADS_DEMUXER 0 %define CONFIG_ADX_DEMUXER 0 %define CONFIG_AEA_DEMUXER 0 %define CONFIG_AFC_DEMUXER 0 %define CONFIG_AIFF_DEMUXER 0 %define CONFIG_AMR_DEMUXER 0 %define CONFIG_ANM_DEMUXER 0 %define CONFIG_APC_DEMUXER 0 %define CONFIG_APE_DEMUXER 0 %define CONFIG_APNG_DEMUXER 0 %define CONFIG_AQTITLE_DEMUXER 0 %define CONFIG_ASF_DEMUXER 0 %define CONFIG_ASF_O_DEMUXER 0 %define CONFIG_ASS_DEMUXER 0 %define CONFIG_AST_DEMUXER 0 %define CONFIG_AU_DEMUXER 0 %define CONFIG_AVI_DEMUXER 0 %define CONFIG_AVISYNTH_DEMUXER 0 %define CONFIG_AVR_DEMUXER 0 %define CONFIG_AVS_DEMUXER 0 %define CONFIG_BETHSOFTVID_DEMUXER 0 %define CONFIG_BFI_DEMUXER 0 %define CONFIG_BINTEXT_DEMUXER 0 %define CONFIG_BINK_DEMUXER 0 %define CONFIG_BIT_DEMUXER 0 %define CONFIG_BMV_DEMUXER 0 %define CONFIG_BFSTM_DEMUXER 0 %define CONFIG_BRSTM_DEMUXER 0 %define CONFIG_BOA_DEMUXER 0 %define CONFIG_C93_DEMUXER 0 %define CONFIG_CAF_DEMUXER 0 %define CONFIG_CAVSVIDEO_DEMUXER 0 %define CONFIG_CDG_DEMUXER 0 %define CONFIG_CDXL_DEMUXER 0 %define CONFIG_CINE_DEMUXER 0 %define CONFIG_CONCAT_DEMUXER 0 %define CONFIG_DATA_DEMUXER 0 %define CONFIG_DAUD_DEMUXER 0 %define CONFIG_DCSTR_DEMUXER 0 %define CONFIG_DFA_DEMUXER 0 %define CONFIG_DIRAC_DEMUXER 0 %define CONFIG_DNXHD_DEMUXER 0 %define CONFIG_DSF_DEMUXER 0 %define CONFIG_DSICIN_DEMUXER 0 %define CONFIG_DSS_DEMUXER 0 %define CONFIG_DTS_DEMUXER 0 %define CONFIG_DTSHD_DEMUXER 0 %define CONFIG_DV_DEMUXER 0 %define CONFIG_DVBSUB_DEMUXER 0 %define CONFIG_DXA_DEMUXER 0 %define CONFIG_EA_DEMUXER 0 %define CONFIG_EA_CDATA_DEMUXER 0 %define CONFIG_EAC3_DEMUXER 0 %define CONFIG_EPAF_DEMUXER 0 %define CONFIG_FFM_DEMUXER 0 %define CONFIG_FFMETADATA_DEMUXER 0 %define CONFIG_FILMSTRIP_DEMUXER 0 %define CONFIG_FLAC_DEMUXER 0 %define CONFIG_FLIC_DEMUXER 0 %define CONFIG_FLV_DEMUXER 0 %define CONFIG_LIVE_FLV_DEMUXER 0 %define CONFIG_FOURXM_DEMUXER 0 %define CONFIG_FRM_DEMUXER 0 %define CONFIG_FSB_DEMUXER 0 %define CONFIG_G722_DEMUXER 0 %define CONFIG_G723_1_DEMUXER 0 %define CONFIG_G729_DEMUXER 0 %define CONFIG_GENH_DEMUXER 0 %define CONFIG_GIF_DEMUXER 0 %define CONFIG_GSM_DEMUXER 0 %define CONFIG_GXF_DEMUXER 0 %define CONFIG_H261_DEMUXER 0 %define CONFIG_H263_DEMUXER 0 %define CONFIG_H264_DEMUXER 0 %define CONFIG_HEVC_DEMUXER 0 %define CONFIG_HLS_DEMUXER 0 %define CONFIG_HNM_DEMUXER 0 %define CONFIG_ICO_DEMUXER 0 %define CONFIG_IDCIN_DEMUXER 0 %define CONFIG_IDF_DEMUXER 0 %define CONFIG_IFF_DEMUXER 0 %define CONFIG_ILBC_DEMUXER 0 %define CONFIG_IMAGE2_DEMUXER 0 %define CONFIG_IMAGE2PIPE_DEMUXER 0 %define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0 %define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0 %define CONFIG_INGENIENT_DEMUXER 0 %define CONFIG_IPMOVIE_DEMUXER 0 %define CONFIG_IRCAM_DEMUXER 0 %define CONFIG_ISS_DEMUXER 0 %define CONFIG_IV8_DEMUXER 0 %define CONFIG_IVF_DEMUXER 0 %define CONFIG_IVR_DEMUXER 0 %define CONFIG_JACOSUB_DEMUXER 0 %define CONFIG_JV_DEMUXER 0 %define CONFIG_LMLM4_DEMUXER 0 %define CONFIG_LOAS_DEMUXER 0 %define CONFIG_LRC_DEMUXER 0 %define CONFIG_LVF_DEMUXER 0 %define CONFIG_LXF_DEMUXER 0 %define CONFIG_M4V_DEMUXER 0 %define CONFIG_MATROSKA_DEMUXER 1 %define CONFIG_MGSTS_DEMUXER 0 %define CONFIG_MICRODVD_DEMUXER 0 %define CONFIG_MJPEG_DEMUXER 0 %define CONFIG_MLP_DEMUXER 0 %define CONFIG_MLV_DEMUXER 0 %define CONFIG_MM_DEMUXER 0 %define CONFIG_MMF_DEMUXER 0 %define CONFIG_MOV_DEMUXER 1 %define CONFIG_MP3_DEMUXER 1 %define CONFIG_MPC_DEMUXER 0 %define CONFIG_MPC8_DEMUXER 0 %define CONFIG_MPEGPS_DEMUXER 0 %define CONFIG_MPEGTS_DEMUXER 0 %define CONFIG_MPEGTSRAW_DEMUXER 0 %define CONFIG_MPEGVIDEO_DEMUXER 0 %define CONFIG_MPJPEG_DEMUXER 0 %define CONFIG_MPL2_DEMUXER 0 %define CONFIG_MPSUB_DEMUXER 0 %define CONFIG_MSF_DEMUXER 0 %define CONFIG_MSNWC_TCP_DEMUXER 0 %define CONFIG_MTV_DEMUXER 0 %define CONFIG_MV_DEMUXER 0 %define CONFIG_MVI_DEMUXER 0 %define CONFIG_MXF_DEMUXER 0 %define CONFIG_MXG_DEMUXER 0 %define CONFIG_NC_DEMUXER 0 %define CONFIG_NISTSPHERE_DEMUXER 0 %define CONFIG_NSV_DEMUXER 0 %define CONFIG_NUT_DEMUXER 0 %define CONFIG_NUV_DEMUXER 0 %define CONFIG_OGG_DEMUXER 1 %define CONFIG_OMA_DEMUXER 0 %define CONFIG_PAF_DEMUXER 0 %define CONFIG_PCM_ALAW_DEMUXER 0 %define CONFIG_PCM_MULAW_DEMUXER 0 %define CONFIG_PCM_F64BE_DEMUXER 0 %define CONFIG_PCM_F64LE_DEMUXER 0 %define CONFIG_PCM_F32BE_DEMUXER 0 %define CONFIG_PCM_F32LE_DEMUXER 0 %define CONFIG_PCM_S32BE_DEMUXER 0 %define CONFIG_PCM_S32LE_DEMUXER 0 %define CONFIG_PCM_S24BE_DEMUXER 0 %define CONFIG_PCM_S24LE_DEMUXER 0 %define CONFIG_PCM_S16BE_DEMUXER 0 %define CONFIG_PCM_S16LE_DEMUXER 0 %define CONFIG_PCM_S8_DEMUXER 0 %define CONFIG_PCM_U32BE_DEMUXER 0 %define CONFIG_PCM_U32LE_DEMUXER 0 %define CONFIG_PCM_U24BE_DEMUXER 0 %define CONFIG_PCM_U24LE_DEMUXER 0 %define CONFIG_PCM_U16BE_DEMUXER 0 %define CONFIG_PCM_U16LE_DEMUXER 0 %define CONFIG_PCM_U8_DEMUXER 0 %define CONFIG_PJS_DEMUXER 0 %define CONFIG_PMP_DEMUXER 0 %define CONFIG_PVA_DEMUXER 0 %define CONFIG_PVF_DEMUXER 0 %define CONFIG_QCP_DEMUXER 0 %define CONFIG_R3D_DEMUXER 0 %define CONFIG_RAWVIDEO_DEMUXER 0 %define CONFIG_REALTEXT_DEMUXER 0 %define CONFIG_REDSPARK_DEMUXER 0 %define CONFIG_RL2_DEMUXER 0 %define CONFIG_RM_DEMUXER 0 %define CONFIG_ROQ_DEMUXER 0 %define CONFIG_RPL_DEMUXER 0 %define CONFIG_RSD_DEMUXER 0 %define CONFIG_RSO_DEMUXER 0 %define CONFIG_RTP_DEMUXER 0 %define CONFIG_RTSP_DEMUXER 0 %define CONFIG_SAMI_DEMUXER 0 %define CONFIG_SAP_DEMUXER 0 %define CONFIG_SBG_DEMUXER 0 %define CONFIG_SDP_DEMUXER 0 %define CONFIG_SDR2_DEMUXER 0 %define CONFIG_SEGAFILM_DEMUXER 0 %define CONFIG_SHORTEN_DEMUXER 0 %define CONFIG_SIFF_DEMUXER 0 %define CONFIG_SLN_DEMUXER 0 %define CONFIG_SMACKER_DEMUXER 0 %define CONFIG_SMJPEG_DEMUXER 0 %define CONFIG_SMUSH_DEMUXER 0 %define CONFIG_SOL_DEMUXER 0 %define CONFIG_SOX_DEMUXER 0 %define CONFIG_SPDIF_DEMUXER 0 %define CONFIG_SRT_DEMUXER 0 %define CONFIG_STR_DEMUXER 0 %define CONFIG_STL_DEMUXER 0 %define CONFIG_SUBVIEWER1_DEMUXER 0 %define CONFIG_SUBVIEWER_DEMUXER 0 %define CONFIG_SUP_DEMUXER 0 %define CONFIG_SVAG_DEMUXER 0 %define CONFIG_SWF_DEMUXER 0 %define CONFIG_TAK_DEMUXER 0 %define CONFIG_TEDCAPTIONS_DEMUXER 0 %define CONFIG_THP_DEMUXER 0 %define CONFIG_THREEDOSTR_DEMUXER 0 %define CONFIG_TIERTEXSEQ_DEMUXER 0 %define CONFIG_TMV_DEMUXER 0 %define CONFIG_TRUEHD_DEMUXER 0 %define CONFIG_TTA_DEMUXER 0 %define CONFIG_TXD_DEMUXER 0 %define CONFIG_TTY_DEMUXER 0 %define CONFIG_V210_DEMUXER 0 %define CONFIG_V210X_DEMUXER 0 %define CONFIG_VAG_DEMUXER 0 %define CONFIG_VC1_DEMUXER 0 %define CONFIG_VC1T_DEMUXER 0 %define CONFIG_VIVO_DEMUXER 0 %define CONFIG_VMD_DEMUXER 0 %define CONFIG_VOBSUB_DEMUXER 0 %define CONFIG_VOC_DEMUXER 0 %define CONFIG_VPK_DEMUXER 0 %define CONFIG_VPLAYER_DEMUXER 0 %define CONFIG_VQF_DEMUXER 0 %define CONFIG_W64_DEMUXER 0 %define CONFIG_WAV_DEMUXER 1 %define CONFIG_WC3_DEMUXER 0 %define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0 %define CONFIG_WEBVTT_DEMUXER 0 %define CONFIG_WSAUD_DEMUXER 0 %define CONFIG_WSVQA_DEMUXER 0 %define CONFIG_WTV_DEMUXER 0 %define CONFIG_WVE_DEMUXER 0 %define CONFIG_WV_DEMUXER 0 %define CONFIG_XA_DEMUXER 0 %define CONFIG_XBIN_DEMUXER 0 %define CONFIG_XMV_DEMUXER 0 %define CONFIG_XVAG_DEMUXER 0 %define CONFIG_XWMA_DEMUXER 0 %define CONFIG_YOP_DEMUXER 0 %define CONFIG_YUV4MPEGPIPE_DEMUXER 0 %define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0 %define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0 %define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0 %define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0 %define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0 %define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0 %define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0 %define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0 %define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0 %define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0 %define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0 %define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0 %define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0 %define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0 %define CONFIG_LIBGME_DEMUXER 0 %define CONFIG_LIBMODPLUG_DEMUXER 0 %define CONFIG_LIBNUT_DEMUXER 0 %define CONFIG_LIBQUVI_DEMUXER 0 %define CONFIG_A64MULTI_ENCODER 0 %define CONFIG_A64MULTI5_ENCODER 0 %define CONFIG_ALIAS_PIX_ENCODER 0 %define CONFIG_AMV_ENCODER 0 %define CONFIG_APNG_ENCODER 0 %define CONFIG_ASV1_ENCODER 0 %define CONFIG_ASV2_ENCODER 0 %define CONFIG_AVRP_ENCODER 0 %define CONFIG_AVUI_ENCODER 0 %define CONFIG_AYUV_ENCODER 0 %define CONFIG_BMP_ENCODER 0 %define CONFIG_CINEPAK_ENCODER 0 %define CONFIG_CLJR_ENCODER 0 %define CONFIG_COMFORTNOISE_ENCODER 0 %define CONFIG_DNXHD_ENCODER 0 %define CONFIG_DPX_ENCODER 0 %define CONFIG_DVVIDEO_ENCODER 0 %define CONFIG_FFV1_ENCODER 0 %define CONFIG_FFVHUFF_ENCODER 0 %define CONFIG_FLASHSV_ENCODER 0 %define CONFIG_FLASHSV2_ENCODER 0 %define CONFIG_FLV_ENCODER 0 %define CONFIG_GIF_ENCODER 0 %define CONFIG_H261_ENCODER 0 %define CONFIG_H263_ENCODER 0 %define CONFIG_H263P_ENCODER 0 %define CONFIG_HAP_ENCODER 0 %define CONFIG_HUFFYUV_ENCODER 0 %define CONFIG_JPEG2000_ENCODER 0 %define CONFIG_JPEGLS_ENCODER 0 %define CONFIG_LJPEG_ENCODER 0 %define CONFIG_MJPEG_ENCODER 0 %define CONFIG_MPEG1VIDEO_ENCODER 0 %define CONFIG_MPEG2VIDEO_ENCODER 0 %define CONFIG_MPEG4_ENCODER 0 %define CONFIG_MSMPEG4V2_ENCODER 0 %define CONFIG_MSMPEG4V3_ENCODER 0 %define CONFIG_MSVIDEO1_ENCODER 0 %define CONFIG_PAM_ENCODER 0 %define CONFIG_PBM_ENCODER 0 %define CONFIG_PCX_ENCODER 0 %define CONFIG_PGM_ENCODER 0 %define CONFIG_PGMYUV_ENCODER 0 %define CONFIG_PNG_ENCODER 0 %define CONFIG_PPM_ENCODER 0 %define CONFIG_PRORES_ENCODER 0 %define CONFIG_PRORES_AW_ENCODER 0 %define CONFIG_PRORES_KS_ENCODER 0 %define CONFIG_QTRLE_ENCODER 0 %define CONFIG_R10K_ENCODER 0 %define CONFIG_R210_ENCODER 0 %define CONFIG_RAWVIDEO_ENCODER 0 %define CONFIG_ROQ_ENCODER 0 %define CONFIG_RV10_ENCODER 0 %define CONFIG_RV20_ENCODER 0 %define CONFIG_S302M_ENCODER 0 %define CONFIG_SGI_ENCODER 0 %define CONFIG_SNOW_ENCODER 0 %define CONFIG_SUNRAST_ENCODER 0 %define CONFIG_SVQ1_ENCODER 0 %define CONFIG_TARGA_ENCODER 0 %define CONFIG_TIFF_ENCODER 0 %define CONFIG_UTVIDEO_ENCODER 0 %define CONFIG_V210_ENCODER 0 %define CONFIG_V308_ENCODER 0 %define CONFIG_V408_ENCODER 0 %define CONFIG_V410_ENCODER 0 %define CONFIG_WRAPPED_AVFRAME_ENCODER 0 %define CONFIG_WMV1_ENCODER 0 %define CONFIG_WMV2_ENCODER 0 %define CONFIG_XBM_ENCODER 0 %define CONFIG_XFACE_ENCODER 0 %define CONFIG_XWD_ENCODER 0 %define CONFIG_Y41P_ENCODER 0 %define CONFIG_YUV4_ENCODER 0 %define CONFIG_ZLIB_ENCODER 0 %define CONFIG_ZMBV_ENCODER 0 %define CONFIG_AAC_ENCODER 0 %define CONFIG_AC3_ENCODER 0 %define CONFIG_AC3_FIXED_ENCODER 0 %define CONFIG_ALAC_ENCODER 0 %define CONFIG_DCA_ENCODER 0 %define CONFIG_EAC3_ENCODER 0 %define CONFIG_FLAC_ENCODER 0 %define CONFIG_G723_1_ENCODER 0 %define CONFIG_MP2_ENCODER 0 %define CONFIG_MP2FIXED_ENCODER 0 %define CONFIG_NELLYMOSER_ENCODER 0 %define CONFIG_RA_144_ENCODER 0 %define CONFIG_SONIC_ENCODER 0 %define CONFIG_SONIC_LS_ENCODER 0 %define CONFIG_TTA_ENCODER 0 %define CONFIG_VORBIS_ENCODER 0 %define CONFIG_WAVPACK_ENCODER 0 %define CONFIG_WMAV1_ENCODER 0 %define CONFIG_WMAV2_ENCODER 0 %define CONFIG_PCM_ALAW_ENCODER 0 %define CONFIG_PCM_F32BE_ENCODER 0 %define CONFIG_PCM_F32LE_ENCODER 0 %define CONFIG_PCM_F64BE_ENCODER 0 %define CONFIG_PCM_F64LE_ENCODER 0 %define CONFIG_PCM_MULAW_ENCODER 0 %define CONFIG_PCM_S8_ENCODER 0 %define CONFIG_PCM_S8_PLANAR_ENCODER 0 %define CONFIG_PCM_S16BE_ENCODER 0 %define CONFIG_PCM_S16BE_PLANAR_ENCODER 0 %define CONFIG_PCM_S16LE_ENCODER 0 %define CONFIG_PCM_S16LE_PLANAR_ENCODER 0 %define CONFIG_PCM_S24BE_ENCODER 0 %define CONFIG_PCM_S24DAUD_ENCODER 0 %define CONFIG_PCM_S24LE_ENCODER 0 %define CONFIG_PCM_S24LE_PLANAR_ENCODER 0 %define CONFIG_PCM_S32BE_ENCODER 0 %define CONFIG_PCM_S32LE_ENCODER 0 %define CONFIG_PCM_S32LE_PLANAR_ENCODER 0 %define CONFIG_PCM_U8_ENCODER 0 %define CONFIG_PCM_U16BE_ENCODER 0 %define CONFIG_PCM_U16LE_ENCODER 0 %define CONFIG_PCM_U24BE_ENCODER 0 %define CONFIG_PCM_U24LE_ENCODER 0 %define CONFIG_PCM_U32BE_ENCODER 0 %define CONFIG_PCM_U32LE_ENCODER 0 %define CONFIG_ROQ_DPCM_ENCODER 0 %define CONFIG_ADPCM_ADX_ENCODER 0 %define CONFIG_ADPCM_G722_ENCODER 0 %define CONFIG_ADPCM_G726_ENCODER 0 %define CONFIG_ADPCM_IMA_QT_ENCODER 0 %define CONFIG_ADPCM_IMA_WAV_ENCODER 0 %define CONFIG_ADPCM_MS_ENCODER 0 %define CONFIG_ADPCM_SWF_ENCODER 0 %define CONFIG_ADPCM_YAMAHA_ENCODER 0 %define CONFIG_SSA_ENCODER 0 %define CONFIG_ASS_ENCODER 0 %define CONFIG_DVBSUB_ENCODER 0 %define CONFIG_DVDSUB_ENCODER 0 %define CONFIG_MOVTEXT_ENCODER 0 %define CONFIG_SRT_ENCODER 0 %define CONFIG_SUBRIP_ENCODER 0 %define CONFIG_TEXT_ENCODER 0 %define CONFIG_WEBVTT_ENCODER 0 %define CONFIG_XSUB_ENCODER 0 %define CONFIG_LIBFAAC_ENCODER 0 %define CONFIG_LIBFDK_AAC_ENCODER 0 %define CONFIG_LIBGSM_ENCODER 0 %define CONFIG_LIBGSM_MS_ENCODER 0 %define CONFIG_LIBILBC_ENCODER 0 %define CONFIG_LIBMP3LAME_ENCODER 0 %define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0 %define CONFIG_LIBOPENJPEG_ENCODER 0 %define CONFIG_LIBOPUS_ENCODER 0 %define CONFIG_LIBSCHROEDINGER_ENCODER 0 %define CONFIG_LIBSHINE_ENCODER 0 %define CONFIG_LIBSPEEX_ENCODER 0 %define CONFIG_LIBTHEORA_ENCODER 0 %define CONFIG_LIBTWOLAME_ENCODER 0 %define CONFIG_LIBUTVIDEO_ENCODER 0 %define CONFIG_LIBVO_AACENC_ENCODER 0 %define CONFIG_LIBVO_AMRWBENC_ENCODER 0 %define CONFIG_LIBVORBIS_ENCODER 0 %define CONFIG_LIBVPX_VP8_ENCODER 0 %define CONFIG_LIBVPX_VP9_ENCODER 0 %define CONFIG_LIBWAVPACK_ENCODER 0 %define CONFIG_LIBWEBP_ANIM_ENCODER 0 %define CONFIG_LIBWEBP_ENCODER 0 %define CONFIG_LIBX262_ENCODER 0 %define CONFIG_LIBX264_ENCODER 0 %define CONFIG_LIBX264RGB_ENCODER 0 %define CONFIG_LIBX265_ENCODER 0 %define CONFIG_LIBXAVS_ENCODER 0 %define CONFIG_LIBXVID_ENCODER 0 %define CONFIG_LIBAACPLUS_ENCODER 0 %define CONFIG_LIBOPENH264_ENCODER 0 %define CONFIG_H264_QSV_ENCODER 0 %define CONFIG_NVENC_ENCODER 0 %define CONFIG_NVENC_H264_ENCODER 0 %define CONFIG_NVENC_HEVC_ENCODER 0 %define CONFIG_HEVC_QSV_ENCODER 0 %define CONFIG_LIBKVAZAAR_ENCODER 0 %define CONFIG_MPEG2_QSV_ENCODER 0 %define CONFIG_ACOMPRESSOR_FILTER 0 %define CONFIG_ACROSSFADE_FILTER 0 %define CONFIG_ADELAY_FILTER 0 %define CONFIG_AECHO_FILTER 0 %define CONFIG_AEMPHASIS_FILTER 0 %define CONFIG_AEVAL_FILTER 0 %define CONFIG_AFADE_FILTER 0 %define CONFIG_AFORMAT_FILTER 0 %define CONFIG_AGATE_FILTER 0 %define CONFIG_AINTERLEAVE_FILTER 0 %define CONFIG_ALIMITER_FILTER 0 %define CONFIG_ALLPASS_FILTER 0 %define CONFIG_AMERGE_FILTER 0 %define CONFIG_AMIX_FILTER 0 %define CONFIG_ANEQUALIZER_FILTER 0 %define CONFIG_ANULL_FILTER 0 %define CONFIG_APAD_FILTER 0 %define CONFIG_APERMS_FILTER 0 %define CONFIG_APHASER_FILTER 0 %define CONFIG_APULSATOR_FILTER 0 %define CONFIG_AREALTIME_FILTER 0 %define CONFIG_ARESAMPLE_FILTER 0 %define CONFIG_AREVERSE_FILTER 0 %define CONFIG_ASELECT_FILTER 0 %define CONFIG_ASENDCMD_FILTER 0 %define CONFIG_ASETNSAMPLES_FILTER 0 %define CONFIG_ASETPTS_FILTER 0 %define CONFIG_ASETRATE_FILTER 0 %define CONFIG_ASETTB_FILTER 0 %define CONFIG_ASHOWINFO_FILTER 0 %define CONFIG_ASPLIT_FILTER 0 %define CONFIG_ASTATS_FILTER 0 %define CONFIG_ASYNCTS_FILTER 0 %define CONFIG_ATEMPO_FILTER 0 %define CONFIG_ATRIM_FILTER 0 %define CONFIG_AZMQ_FILTER 0 %define CONFIG_BANDPASS_FILTER 0 %define CONFIG_BANDREJECT_FILTER 0 %define CONFIG_BASS_FILTER 0 %define CONFIG_BIQUAD_FILTER 0 %define CONFIG_BS2B_FILTER 0 %define CONFIG_CHANNELMAP_FILTER 0 %define CONFIG_CHANNELSPLIT_FILTER 0 %define CONFIG_CHORUS_FILTER 0 %define CONFIG_COMPAND_FILTER 0 %define CONFIG_COMPENSATIONDELAY_FILTER 0 %define CONFIG_DCSHIFT_FILTER 0 %define CONFIG_DYNAUDNORM_FILTER 0 %define CONFIG_EARWAX_FILTER 0 %define CONFIG_EBUR128_FILTER 0 %define CONFIG_EQUALIZER_FILTER 0 %define CONFIG_EXTRASTEREO_FILTER 0 %define CONFIG_FLANGER_FILTER 0 %define CONFIG_HIGHPASS_FILTER 0 %define CONFIG_JOIN_FILTER 0 %define CONFIG_LADSPA_FILTER 0 %define CONFIG_LOWPASS_FILTER 0 %define CONFIG_PAN_FILTER 0 %define CONFIG_REPLAYGAIN_FILTER 0 %define CONFIG_RESAMPLE_FILTER 0 %define CONFIG_RUBBERBAND_FILTER 0 %define CONFIG_SIDECHAINCOMPRESS_FILTER 0 %define CONFIG_SIDECHAINGATE_FILTER 0 %define CONFIG_SILENCEDETECT_FILTER 0 %define CONFIG_SILENCEREMOVE_FILTER 0 %define CONFIG_SOFALIZER_FILTER 0 %define CONFIG_STEREOTOOLS_FILTER 0 %define CONFIG_STEREOWIDEN_FILTER 0 %define CONFIG_TREBLE_FILTER 0 %define CONFIG_TREMOLO_FILTER 0 %define CONFIG_VIBRATO_FILTER 0 %define CONFIG_VOLUME_FILTER 0 %define CONFIG_VOLUMEDETECT_FILTER 0 %define CONFIG_AEVALSRC_FILTER 0 %define CONFIG_ANOISESRC_FILTER 0 %define CONFIG_ANULLSRC_FILTER 0 %define CONFIG_FLITE_FILTER 0 %define CONFIG_SINE_FILTER 0 %define CONFIG_ANULLSINK_FILTER 0 %define CONFIG_ALPHAEXTRACT_FILTER 0 %define CONFIG_ALPHAMERGE_FILTER 0 %define CONFIG_ATADENOISE_FILTER 0 %define CONFIG_ASS_FILTER 0 %define CONFIG_BBOX_FILTER 0 %define CONFIG_BLACKDETECT_FILTER 0 %define CONFIG_BLACKFRAME_FILTER 0 %define CONFIG_BLEND_FILTER 0 %define CONFIG_BOXBLUR_FILTER 0 %define CONFIG_CHROMAKEY_FILTER 0 %define CONFIG_CODECVIEW_FILTER 0 %define CONFIG_COLORBALANCE_FILTER 0 %define CONFIG_COLORCHANNELMIXER_FILTER 0 %define CONFIG_COLORKEY_FILTER 0 %define CONFIG_COLORLEVELS_FILTER 0 %define CONFIG_COLORMATRIX_FILTER 0 %define CONFIG_COPY_FILTER 0 %define CONFIG_COVER_RECT_FILTER 0 %define CONFIG_CROP_FILTER 0 %define CONFIG_CROPDETECT_FILTER 0 %define CONFIG_CURVES_FILTER 0 %define CONFIG_DCTDNOIZ_FILTER 0 %define CONFIG_DEBAND_FILTER 0 %define CONFIG_DECIMATE_FILTER 0 %define CONFIG_DEFLATE_FILTER 0 %define CONFIG_DEJUDDER_FILTER 0 %define CONFIG_DELOGO_FILTER 0 %define CONFIG_DESHAKE_FILTER 0 %define CONFIG_DETELECINE_FILTER 0 %define CONFIG_DILATION_FILTER 0 %define CONFIG_DISPLACE_FILTER 0 %define CONFIG_DRAWBOX_FILTER 0 %define CONFIG_DRAWGRAPH_FILTER 0 %define CONFIG_DRAWGRID_FILTER 0 %define CONFIG_DRAWTEXT_FILTER 0 %define CONFIG_EDGEDETECT_FILTER 0 %define CONFIG_ELBG_FILTER 0 %define CONFIG_EQ_FILTER 0 %define CONFIG_EROSION_FILTER 0 %define CONFIG_EXTRACTPLANES_FILTER 0 %define CONFIG_FADE_FILTER 0 %define CONFIG_FFTFILT_FILTER 0 %define CONFIG_FIELD_FILTER 0 %define CONFIG_FIELDMATCH_FILTER 0 %define CONFIG_FIELDORDER_FILTER 0 %define CONFIG_FIND_RECT_FILTER 0 %define CONFIG_FORMAT_FILTER 0 %define CONFIG_FPS_FILTER 0 %define CONFIG_FRAMEPACK_FILTER 0 %define CONFIG_FRAMERATE_FILTER 0 %define CONFIG_FRAMESTEP_FILTER 0 %define CONFIG_FREI0R_FILTER 0 %define CONFIG_FSPP_FILTER 0 %define CONFIG_GEQ_FILTER 0 %define CONFIG_GRADFUN_FILTER 0 %define CONFIG_HALDCLUT_FILTER 0 %define CONFIG_HFLIP_FILTER 0 %define CONFIG_HISTEQ_FILTER 0 %define CONFIG_HISTOGRAM_FILTER 0 %define CONFIG_HQDN3D_FILTER 0 %define CONFIG_HQX_FILTER 0 %define CONFIG_HSTACK_FILTER 0 %define CONFIG_HUE_FILTER 0 %define CONFIG_IDET_FILTER 0 %define CONFIG_IL_FILTER 0 %define CONFIG_INFLATE_FILTER 0 %define CONFIG_INTERLACE_FILTER 0 %define CONFIG_INTERLEAVE_FILTER 0 %define CONFIG_KERNDEINT_FILTER 0 %define CONFIG_LENSCORRECTION_FILTER 0 %define CONFIG_LUT3D_FILTER 0 %define CONFIG_LUT_FILTER 0 %define CONFIG_LUTRGB_FILTER 0 %define CONFIG_LUTYUV_FILTER 0 %define CONFIG_MASKEDMERGE_FILTER 0 %define CONFIG_MCDEINT_FILTER 0 %define CONFIG_MERGEPLANES_FILTER 0 %define CONFIG_MPDECIMATE_FILTER 0 %define CONFIG_NEGATE_FILTER 0 %define CONFIG_NOFORMAT_FILTER 0 %define CONFIG_NOISE_FILTER 0 %define CONFIG_NULL_FILTER 0 %define CONFIG_OCR_FILTER 0 %define CONFIG_OCV_FILTER 0 %define CONFIG_OVERLAY_FILTER 0 %define CONFIG_OWDENOISE_FILTER 0 %define CONFIG_PAD_FILTER 0 %define CONFIG_PALETTEGEN_FILTER 0 %define CONFIG_PALETTEUSE_FILTER 0 %define CONFIG_PERMS_FILTER 0 %define CONFIG_PERSPECTIVE_FILTER 0 %define CONFIG_PHASE_FILTER 0 %define CONFIG_PIXDESCTEST_FILTER 0 %define CONFIG_PP_FILTER 0 %define CONFIG_PP7_FILTER 0 %define CONFIG_PSNR_FILTER 0 %define CONFIG_PULLUP_FILTER 0 %define CONFIG_QP_FILTER 0 %define CONFIG_RANDOM_FILTER 0 %define CONFIG_REALTIME_FILTER 0 %define CONFIG_REMOVEGRAIN_FILTER 0 %define CONFIG_REMOVELOGO_FILTER 0 %define CONFIG_REPEATFIELDS_FILTER 0 %define CONFIG_REVERSE_FILTER 0 %define CONFIG_ROTATE_FILTER 0 %define CONFIG_SAB_FILTER 0 %define CONFIG_SCALE_FILTER 0 %define CONFIG_SCALE2REF_FILTER 0 %define CONFIG_SELECT_FILTER 0 %define CONFIG_SELECTIVECOLOR_FILTER 0 %define CONFIG_SENDCMD_FILTER 0 %define CONFIG_SEPARATEFIELDS_FILTER 0 %define CONFIG_SETDAR_FILTER 0 %define CONFIG_SETFIELD_FILTER 0 %define CONFIG_SETPTS_FILTER 0 %define CONFIG_SETSAR_FILTER 0 %define CONFIG_SETTB_FILTER 0 %define CONFIG_SHOWINFO_FILTER 0 %define CONFIG_SHOWPALETTE_FILTER 0 %define CONFIG_SHUFFLEFRAMES_FILTER 0 %define CONFIG_SHUFFLEPLANES_FILTER 0 %define CONFIG_SIGNALSTATS_FILTER 0 %define CONFIG_SMARTBLUR_FILTER 0 %define CONFIG_SPLIT_FILTER 0 %define CONFIG_SPP_FILTER 0 %define CONFIG_SSIM_FILTER 0 %define CONFIG_STEREO3D_FILTER 0 %define CONFIG_SUBTITLES_FILTER 0 %define CONFIG_SUPER2XSAI_FILTER 0 %define CONFIG_SWAPUV_FILTER 0 %define CONFIG_TBLEND_FILTER 0 %define CONFIG_TELECINE_FILTER 0 %define CONFIG_THUMBNAIL_FILTER 0 %define CONFIG_TILE_FILTER 0 %define CONFIG_TINTERLACE_FILTER 0 %define CONFIG_TRANSPOSE_FILTER 0 %define CONFIG_TRIM_FILTER 0 %define CONFIG_UNSHARP_FILTER 0 %define CONFIG_USPP_FILTER 0 %define CONFIG_VECTORSCOPE_FILTER 0 %define CONFIG_VFLIP_FILTER 0 %define CONFIG_VIDSTABDETECT_FILTER 0 %define CONFIG_VIDSTABTRANSFORM_FILTER 0 %define CONFIG_VIGNETTE_FILTER 0 %define CONFIG_VSTACK_FILTER 0 %define CONFIG_W3FDIF_FILTER 0 %define CONFIG_WAVEFORM_FILTER 0 %define CONFIG_XBR_FILTER 0 %define CONFIG_YADIF_FILTER 0 %define CONFIG_ZMQ_FILTER 0 %define CONFIG_ZOOMPAN_FILTER 0 %define CONFIG_ZSCALE_FILTER 0 %define CONFIG_ALLRGB_FILTER 0 %define CONFIG_ALLYUV_FILTER 0 %define CONFIG_CELLAUTO_FILTER 0 %define CONFIG_COLOR_FILTER 0 %define CONFIG_FREI0R_SRC_FILTER 0 %define CONFIG_HALDCLUTSRC_FILTER 0 %define CONFIG_LIFE_FILTER 0 %define CONFIG_MANDELBROT_FILTER 0 %define CONFIG_MPTESTSRC_FILTER 0 %define CONFIG_NULLSRC_FILTER 0 %define CONFIG_RGBTESTSRC_FILTER 0 %define CONFIG_SMPTEBARS_FILTER 0 %define CONFIG_SMPTEHDBARS_FILTER 0 %define CONFIG_TESTSRC_FILTER 0 %define CONFIG_TESTSRC2_FILTER 0 %define CONFIG_NULLSINK_FILTER 0 %define CONFIG_ADRAWGRAPH_FILTER 0 %define CONFIG_APHASEMETER_FILTER 0 %define CONFIG_AVECTORSCOPE_FILTER 0 %define CONFIG_CONCAT_FILTER 0 %define CONFIG_SHOWCQT_FILTER 0 %define CONFIG_SHOWFREQS_FILTER 0 %define CONFIG_SHOWSPECTRUM_FILTER 0 %define CONFIG_SHOWSPECTRUMPIC_FILTER 0 %define CONFIG_SHOWVOLUME_FILTER 0 %define CONFIG_SHOWWAVES_FILTER 0 %define CONFIG_SHOWWAVESPIC_FILTER 0 %define CONFIG_AMOVIE_FILTER 0 %define CONFIG_MOVIE_FILTER 0 %define CONFIG_H263_VAAPI_HWACCEL 0 %define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0 %define CONFIG_H264_D3D11VA_HWACCEL 0 %define CONFIG_H264_DXVA2_HWACCEL 0 %define CONFIG_H264_MMAL_HWACCEL 0 %define CONFIG_H264_QSV_HWACCEL 0 %define CONFIG_H264_VAAPI_HWACCEL 0 %define CONFIG_H264_VDA_HWACCEL 0 %define CONFIG_H264_VDA_OLD_HWACCEL 0 %define CONFIG_H264_VDPAU_HWACCEL 0 %define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0 %define CONFIG_HEVC_D3D11VA_HWACCEL 0 %define CONFIG_HEVC_DXVA2_HWACCEL 0 %define CONFIG_HEVC_QSV_HWACCEL 0 %define CONFIG_HEVC_VAAPI_HWACCEL 0 %define CONFIG_HEVC_VDPAU_HWACCEL 0 %define CONFIG_MPEG1_XVMC_HWACCEL 0 %define CONFIG_MPEG1_VDPAU_HWACCEL 0 %define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0 %define CONFIG_MPEG2_XVMC_HWACCEL 0 %define CONFIG_MPEG2_D3D11VA_HWACCEL 0 %define CONFIG_MPEG2_DXVA2_HWACCEL 0 %define CONFIG_MPEG2_MMAL_HWACCEL 0 %define CONFIG_MPEG2_QSV_HWACCEL 0 %define CONFIG_MPEG2_VAAPI_HWACCEL 0 %define CONFIG_MPEG2_VDPAU_HWACCEL 0 %define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0 %define CONFIG_MPEG4_VAAPI_HWACCEL 0 %define CONFIG_MPEG4_VDPAU_HWACCEL 0 %define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0 %define CONFIG_VC1_D3D11VA_HWACCEL 0 %define CONFIG_VC1_DXVA2_HWACCEL 0 %define CONFIG_VC1_VAAPI_HWACCEL 0 %define CONFIG_VC1_VDPAU_HWACCEL 0 %define CONFIG_VC1_MMAL_HWACCEL 0 %define CONFIG_VC1_QSV_HWACCEL 0 %define CONFIG_VP9_D3D11VA_HWACCEL 0 %define CONFIG_VP9_DXVA2_HWACCEL 0 %define CONFIG_VP9_VAAPI_HWACCEL 0 %define CONFIG_WMV3_D3D11VA_HWACCEL 0 %define CONFIG_WMV3_DXVA2_HWACCEL 0 %define CONFIG_WMV3_VAAPI_HWACCEL 0 %define CONFIG_WMV3_VDPAU_HWACCEL 0 %define CONFIG_ALSA_INDEV 0 %define CONFIG_AVFOUNDATION_INDEV 0 %define CONFIG_BKTR_INDEV 0 %define CONFIG_DECKLINK_INDEV 0 %define CONFIG_DSHOW_INDEV 0 %define CONFIG_DV1394_INDEV 0 %define CONFIG_FBDEV_INDEV 0 %define CONFIG_GDIGRAB_INDEV 0 %define CONFIG_IEC61883_INDEV 0 %define CONFIG_JACK_INDEV 0 %define CONFIG_LAVFI_INDEV 0 %define CONFIG_OPENAL_INDEV 0 %define CONFIG_OSS_INDEV 0 %define CONFIG_PULSE_INDEV 0 %define CONFIG_QTKIT_INDEV 0 %define CONFIG_SNDIO_INDEV 0 %define CONFIG_V4L2_INDEV 0 %define CONFIG_VFWCAP_INDEV 0 %define CONFIG_X11GRAB_INDEV 0 %define CONFIG_X11GRAB_XCB_INDEV 0 %define CONFIG_LIBCDIO_INDEV 0 %define CONFIG_LIBDC1394_INDEV 0 %define CONFIG_A64_MUXER 0 %define CONFIG_AC3_MUXER 0 %define CONFIG_ADTS_MUXER 0 %define CONFIG_ADX_MUXER 0 %define CONFIG_AIFF_MUXER 0 %define CONFIG_AMR_MUXER 0 %define CONFIG_APNG_MUXER 0 %define CONFIG_ASF_MUXER 0 %define CONFIG_ASS_MUXER 0 %define CONFIG_AST_MUXER 0 %define CONFIG_ASF_STREAM_MUXER 0 %define CONFIG_AU_MUXER 0 %define CONFIG_AVI_MUXER 0 %define CONFIG_AVM2_MUXER 0 %define CONFIG_BIT_MUXER 0 %define CONFIG_CAF_MUXER 0 %define CONFIG_CAVSVIDEO_MUXER 0 %define CONFIG_CRC_MUXER 0 %define CONFIG_DASH_MUXER 0 %define CONFIG_DATA_MUXER 0 %define CONFIG_DAUD_MUXER 0 %define CONFIG_DIRAC_MUXER 0 %define CONFIG_DNXHD_MUXER 0 %define CONFIG_DTS_MUXER 0 %define CONFIG_DV_MUXER 0 %define CONFIG_EAC3_MUXER 0 %define CONFIG_F4V_MUXER 0 %define CONFIG_FFM_MUXER 0 %define CONFIG_FFMETADATA_MUXER 0 %define CONFIG_FILMSTRIP_MUXER 0 %define CONFIG_FLAC_MUXER 0 %define CONFIG_FLV_MUXER 0 %define CONFIG_FRAMECRC_MUXER 0 %define CONFIG_FRAMEMD5_MUXER 0 %define CONFIG_G722_MUXER 0 %define CONFIG_G723_1_MUXER 0 %define CONFIG_GIF_MUXER 0 %define CONFIG_GXF_MUXER 0 %define CONFIG_H261_MUXER 0 %define CONFIG_H263_MUXER 0 %define CONFIG_H264_MUXER 0 %define CONFIG_HDS_MUXER 0 %define CONFIG_HEVC_MUXER 0 %define CONFIG_HLS_MUXER 0 %define CONFIG_ICO_MUXER 0 %define CONFIG_ILBC_MUXER 0 %define CONFIG_IMAGE2_MUXER 0 %define CONFIG_IMAGE2PIPE_MUXER 0 %define CONFIG_IPOD_MUXER 0 %define CONFIG_IRCAM_MUXER 0 %define CONFIG_ISMV_MUXER 0 %define CONFIG_IVF_MUXER 0 %define CONFIG_JACOSUB_MUXER 0 %define CONFIG_LATM_MUXER 0 %define CONFIG_LRC_MUXER 0 %define CONFIG_M4V_MUXER 0 %define CONFIG_MD5_MUXER 0 %define CONFIG_MATROSKA_MUXER 0 %define CONFIG_MATROSKA_AUDIO_MUXER 0 %define CONFIG_MICRODVD_MUXER 0 %define CONFIG_MJPEG_MUXER 0 %define CONFIG_MLP_MUXER 0 %define CONFIG_MMF_MUXER 0 %define CONFIG_MOV_MUXER 0 %define CONFIG_MP2_MUXER 0 %define CONFIG_MP3_MUXER 0 %define CONFIG_MP4_MUXER 0 %define CONFIG_MPEG1SYSTEM_MUXER 0 %define CONFIG_MPEG1VCD_MUXER 0 %define CONFIG_MPEG1VIDEO_MUXER 0 %define CONFIG_MPEG2DVD_MUXER 0 %define CONFIG_MPEG2SVCD_MUXER 0 %define CONFIG_MPEG2VIDEO_MUXER 0 %define CONFIG_MPEG2VOB_MUXER 0 %define CONFIG_MPEGTS_MUXER 0 %define CONFIG_MPJPEG_MUXER 0 %define CONFIG_MXF_MUXER 0 %define CONFIG_MXF_D10_MUXER 0 %define CONFIG_MXF_OPATOM_MUXER 0 %define CONFIG_NULL_MUXER 0 %define CONFIG_NUT_MUXER 0 %define CONFIG_OGA_MUXER 0 %define CONFIG_OGG_MUXER 0 %define CONFIG_OMA_MUXER 0 %define CONFIG_OPUS_MUXER 0 %define CONFIG_PCM_ALAW_MUXER 0 %define CONFIG_PCM_MULAW_MUXER 0 %define CONFIG_PCM_F64BE_MUXER 0 %define CONFIG_PCM_F64LE_MUXER 0 %define CONFIG_PCM_F32BE_MUXER 0 %define CONFIG_PCM_F32LE_MUXER 0 %define CONFIG_PCM_S32BE_MUXER 0 %define CONFIG_PCM_S32LE_MUXER 0 %define CONFIG_PCM_S24BE_MUXER 0 %define CONFIG_PCM_S24LE_MUXER 0 %define CONFIG_PCM_S16BE_MUXER 0 %define CONFIG_PCM_S16LE_MUXER 0 %define CONFIG_PCM_S8_MUXER 0 %define CONFIG_PCM_U32BE_MUXER 0 %define CONFIG_PCM_U32LE_MUXER 0 %define CONFIG_PCM_U24BE_MUXER 0 %define CONFIG_PCM_U24LE_MUXER 0 %define CONFIG_PCM_U16BE_MUXER 0 %define CONFIG_PCM_U16LE_MUXER 0 %define CONFIG_PCM_U8_MUXER 0 %define CONFIG_PSP_MUXER 0 %define CONFIG_RAWVIDEO_MUXER 0 %define CONFIG_RM_MUXER 0 %define CONFIG_ROQ_MUXER 0 %define CONFIG_RSO_MUXER 0 %define CONFIG_RTP_MUXER 0 %define CONFIG_RTP_MPEGTS_MUXER 0 %define CONFIG_RTSP_MUXER 0 %define CONFIG_SAP_MUXER 0 %define CONFIG_SEGMENT_MUXER 0 %define CONFIG_STREAM_SEGMENT_MUXER 0 %define CONFIG_SINGLEJPEG_MUXER 0 %define CONFIG_SMJPEG_MUXER 0 %define CONFIG_SMOOTHSTREAMING_MUXER 0 %define CONFIG_SOX_MUXER 0 %define CONFIG_SPX_MUXER 0 %define CONFIG_SPDIF_MUXER 0 %define CONFIG_SRT_MUXER 0 %define CONFIG_SWF_MUXER 0 %define CONFIG_TEE_MUXER 0 %define CONFIG_TG2_MUXER 0 %define CONFIG_TGP_MUXER 0 %define CONFIG_MKVTIMESTAMP_V2_MUXER 0 %define CONFIG_TRUEHD_MUXER 0 %define CONFIG_UNCODEDFRAMECRC_MUXER 0 %define CONFIG_VC1_MUXER 0 %define CONFIG_VC1T_MUXER 0 %define CONFIG_VOC_MUXER 0 %define CONFIG_W64_MUXER 0 %define CONFIG_WAV_MUXER 0 %define CONFIG_WEBM_MUXER 0 %define CONFIG_WEBM_DASH_MANIFEST_MUXER 0 %define CONFIG_WEBM_CHUNK_MUXER 0 %define CONFIG_WEBP_MUXER 0 %define CONFIG_WEBVTT_MUXER 0 %define CONFIG_WTV_MUXER 0 %define CONFIG_WV_MUXER 0 %define CONFIG_YUV4MPEGPIPE_MUXER 0 %define CONFIG_CHROMAPRINT_MUXER 0 %define CONFIG_LIBNUT_MUXER 0 %define CONFIG_ALSA_OUTDEV 0 %define CONFIG_CACA_OUTDEV 0 %define CONFIG_DECKLINK_OUTDEV 0 %define CONFIG_FBDEV_OUTDEV 0 %define CONFIG_OPENGL_OUTDEV 0 %define CONFIG_OSS_OUTDEV 0 %define CONFIG_PULSE_OUTDEV 0 %define CONFIG_SDL_OUTDEV 0 %define CONFIG_SNDIO_OUTDEV 0 %define CONFIG_V4L2_OUTDEV 0 %define CONFIG_XV_OUTDEV 0 %define CONFIG_AAC_PARSER 1 %define CONFIG_AAC_LATM_PARSER 0 %define CONFIG_AC3_PARSER 0 %define CONFIG_ADX_PARSER 0 %define CONFIG_BMP_PARSER 0 %define CONFIG_CAVSVIDEO_PARSER 0 %define CONFIG_COOK_PARSER 0 %define CONFIG_DCA_PARSER 0 %define CONFIG_DIRAC_PARSER 0 %define CONFIG_DNXHD_PARSER 0 %define CONFIG_DPX_PARSER 0 %define CONFIG_DVBSUB_PARSER 0 %define CONFIG_DVDSUB_PARSER 0 %define CONFIG_DVD_NAV_PARSER 0 %define CONFIG_FLAC_PARSER 0 %define CONFIG_G729_PARSER 0 %define CONFIG_GSM_PARSER 0 %define CONFIG_H261_PARSER 0 %define CONFIG_H263_PARSER 0 %define CONFIG_H264_PARSER 0 %define CONFIG_HEVC_PARSER 0 %define CONFIG_MJPEG_PARSER 0 %define CONFIG_MLP_PARSER 0 %define CONFIG_MPEG4VIDEO_PARSER 0 %define CONFIG_MPEGAUDIO_PARSER 1 %define CONFIG_MPEGVIDEO_PARSER 0 %define CONFIG_OPUS_PARSER 1 %define CONFIG_PNG_PARSER 0 %define CONFIG_PNM_PARSER 0 %define CONFIG_RV30_PARSER 0 %define CONFIG_RV40_PARSER 0 %define CONFIG_TAK_PARSER 0 %define CONFIG_VC1_PARSER 0 %define CONFIG_VORBIS_PARSER 1 %define CONFIG_VP3_PARSER 0 %define CONFIG_VP8_PARSER 0 %define CONFIG_VP9_PARSER 0 %define CONFIG_ASYNC_PROTOCOL 0 %define CONFIG_BLURAY_PROTOCOL 0 %define CONFIG_CACHE_PROTOCOL 0 %define CONFIG_CONCAT_PROTOCOL 0 %define CONFIG_CRYPTO_PROTOCOL 0 %define CONFIG_DATA_PROTOCOL 0 %define CONFIG_FFRTMPCRYPT_PROTOCOL 0 %define CONFIG_FFRTMPHTTP_PROTOCOL 0 %define CONFIG_FILE_PROTOCOL 0 %define CONFIG_FTP_PROTOCOL 0 %define CONFIG_GOPHER_PROTOCOL 0 %define CONFIG_HLS_PROTOCOL 0 %define CONFIG_HTTP_PROTOCOL 0 %define CONFIG_HTTPPROXY_PROTOCOL 0 %define CONFIG_HTTPS_PROTOCOL 0 %define CONFIG_ICECAST_PROTOCOL 0 %define CONFIG_MMSH_PROTOCOL 0 %define CONFIG_MMST_PROTOCOL 0 %define CONFIG_MD5_PROTOCOL 0 %define CONFIG_PIPE_PROTOCOL 0 %define CONFIG_RTMP_PROTOCOL 0 %define CONFIG_RTMPE_PROTOCOL 0 %define CONFIG_RTMPS_PROTOCOL 0 %define CONFIG_RTMPT_PROTOCOL 0 %define CONFIG_RTMPTE_PROTOCOL 0 %define CONFIG_RTMPTS_PROTOCOL 0 %define CONFIG_RTP_PROTOCOL 0 %define CONFIG_SCTP_PROTOCOL 0 %define CONFIG_SRTP_PROTOCOL 0 %define CONFIG_SUBFILE_PROTOCOL 0 %define CONFIG_TCP_PROTOCOL 0 %define CONFIG_TLS_SCHANNEL_PROTOCOL 0 %define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0 %define CONFIG_TLS_GNUTLS_PROTOCOL 0 %define CONFIG_TLS_OPENSSL_PROTOCOL 0 %define CONFIG_UDP_PROTOCOL 0 %define CONFIG_UDPLITE_PROTOCOL 0 %define CONFIG_UNIX_PROTOCOL 0 %define CONFIG_LIBRTMP_PROTOCOL 0 %define CONFIG_LIBRTMPE_PROTOCOL 0 %define CONFIG_LIBRTMPS_PROTOCOL 0 %define CONFIG_LIBRTMPT_PROTOCOL 0 %define CONFIG_LIBRTMPTE_PROTOCOL 0 %define CONFIG_LIBSSH_PROTOCOL 0 %define CONFIG_LIBSMBCLIENT_PROTOCOL 0
; A215008: a(n) = 7*a(n-1) - 14*a(n-2) + 7*a(n-3), a(0)=0, a(1)=1, a(2)=5. ; Submitted by Christian Krause ; 0,1,5,21,84,329,1274,4900,18767,71687,273371,1041348,3964051,15083082,57374296,218205281,829778397,3155194917,11996903828,45614046737,173428037986,659377938380,2506951364015,9531364676687,36237879209259,137774708539300,523812203582283,1991504659990594,7571584729557296,28786713292108737,109445339450893173,416104483173630965,1582003622947673492,6014679972359133145,22867440467461919882,86940589019839289588,330542716400922080783,1256702851800937950423,4777906056132531549115,18165301482521044103364 mov $1,1 lpb $0 sub $0,1 mul $2,2 add $4,$3 add $3,$1 sub $4,$1 sub $1,$4 add $1,$3 sub $2,5 add $4,5 add $2,$4 mov $4,$2 lpe sub $0,$4
dnl PowerPC-64 mpn_rsh1add_n, mpn_rsh1sub_n dnl Copyright 2003, 2005, 2010, 2013 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C cycles/limb C POWER3/PPC630 ? C POWER4/PPC970 2.9 C POWER5 ? C POWER6 3.5 C POWER7 2.25 define(`rp', `r3') define(`up', `r4') define(`vp', `r5') define(`n', `r6') ifdef(`OPERATION_rsh1add_n', ` define(`ADDSUBC', `addc') define(`ADDSUBE', `adde') define(INITCY, `addic $1, r1, 0') define(`func', mpn_rsh1add_n)') ifdef(`OPERATION_rsh1sub_n', ` define(`ADDSUBC', `subfc') define(`ADDSUBE', `subfe') define(INITCY, `addic $1, r1, -1') define(`func', mpn_rsh1sub_n)') define(`s0', `r9') define(`s1', `r7') define(`x0', `r0') define(`x1', `r12') define(`u0', `r8') define(`v0', `r10') MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1sub_n) ASM_START() PROLOGUE(func) ld u0, 0(up) ld v0, 0(vp) cmpdi cr6, n, 2 addi r0, n, 1 srdi r0, r0, 2 mtctr r0 C copy size to count register andi. r0, n, 1 bne cr0, L(bx1) L(bx0): ADDSUBC x1, v0, u0 ld u0, 8(up) ld v0, 8(vp) ADDSUBE x0, v0, u0 ble cr6, L(n2) ld u0, 16(up) ld v0, 16(vp) srdi s0, x1, 1 rldicl r11, x1, 0, 63 C return value ADDSUBE x1, v0, u0 andi. n, n, 2 bne cr0, L(b10) L(b00): addi rp, rp, -24 b L(lo0) L(b10): addi up, up, 16 addi vp, vp, 16 addi rp, rp, -8 b L(lo2) ALIGN(16) L(bx1): ADDSUBC x0, v0, u0 ble cr6, L(n1) ld u0, 8(up) ld v0, 8(vp) ADDSUBE x1, v0, u0 ld u0, 16(up) ld v0, 16(vp) srdi s1, x0, 1 rldicl r11, x0, 0, 63 C return value ADDSUBE x0, v0, u0 andi. n, n, 2 bne cr0, L(b11) L(b01): addi up, up, 8 addi vp, vp, 8 addi rp, rp, -16 b L(lo1) L(b11): addi up, up, 24 addi vp, vp, 24 bdz L(end) ALIGN(32) L(top): ld u0, 0(up) ld v0, 0(vp) srdi s0, x1, 1 rldimi s1, x1, 63, 0 std s1, 0(rp) ADDSUBE x1, v0, u0 L(lo2): ld u0, 8(up) ld v0, 8(vp) srdi s1, x0, 1 rldimi s0, x0, 63, 0 std s0, 8(rp) ADDSUBE x0, v0, u0 L(lo1): ld u0, 16(up) ld v0, 16(vp) srdi s0, x1, 1 rldimi s1, x1, 63, 0 std s1, 16(rp) ADDSUBE x1, v0, u0 L(lo0): ld u0, 24(up) ld v0, 24(vp) srdi s1, x0, 1 rldimi s0, x0, 63, 0 std s0, 24(rp) ADDSUBE x0, v0, u0 addi up, up, 32 addi vp, vp, 32 addi rp, rp, 32 bdnz L(top) L(end): srdi s0, x1, 1 rldimi s1, x1, 63, 0 std s1, 0(rp) L(cj2): srdi s1, x0, 1 rldimi s0, x0, 63, 0 std s0, 8(rp) L(cj1): ADDSUBE x1, x1, x1 C pseudo-depends on x1 rldimi s1, x1, 63, 0 std s1, 16(rp) mr r3, r11 blr L(n1): srdi s1, x0, 1 rldicl r11, x0, 0, 63 C return value ADDSUBE x1, x1, x1 C pseudo-depends on x1 rldimi s1, x1, 63, 0 std s1, 0(rp) mr r3, r11 blr L(n2): addi rp, rp, -8 srdi s0, x1, 1 rldicl r11, x1, 0, 63 C return value b L(cj2) EPILOGUE()
; A254828: Number of length 1 1..(n+1) arrays with every leading partial sum divisible by 2, 3 or 5. ; 1,2,3,4,5,5,6,7,8,8,9,9,10,11,12,12,13,13,14,15,16,16,17,18,19,20,21,21,22,22,23,24,25,26,27,27,28,29,30,30,31,31,32,33,34,34,35,35,36,37,38,38,39,40,41,42,43,43,44,44,45,46,47,48,49,49,50,51,52,52,53,53,54,55,56,56,57,57,58,59,60,60,61,62,63,64,65,65,66,66,67,68,69,70,71,71,72,73,74,74 mov $3,$0 add $3,1 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 sub $0,$3 add $0,2 gcd $0,120 pow $0,3 mov $2,2 lpb $0 mov $0,5 mov $4,$2 lpe div $4,2 add $1,$4 lpe mov $0,$1
; A057043: Let R(i,j) be the rectangle with antidiagonals 1; 2,3; 4,5,6; ...; each k is an R(i(k),j(k)) and A057043(n)=i(L(n)), where L(n) is the n-th Lucas number. ; 1,1,2,1,1,1,3,1,2,10,3,9,22,25,23,38,62,1,107,33,76,166,263,176,397,430,227,688,811,1481,942,518,2087,2731,3318,2563,6747,6100,12993,8171,6599,15585 seq $0,32 ; Lucas numbers beginning at 2: L(n) = L(n-1) + L(n-2), L(0) = 2, L(1) = 1. sub $0,1 seq $0,25675 ; Exponent of 8 (value of j) in n-th number of form 7^i*8^j. add $0,1
#include <QtMultiProcessSystem/qmpsapplicationplugin.h> #include <QtMultiProcessSystem/qmpsapplication.h> class Weather : public QMpsApplicationPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QMpsApplicationFactoryInterface_iid FILE "weather.json") }; #include "weather.moc"
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x4f7d, %rbp nop nop nop nop sub %rdx, %rdx movl $0x61626364, (%rbp) add %r11, %r11 lea addresses_UC_ht+0x407d, %rsi lea addresses_UC_ht+0xf97d, %rdi nop nop xor $5141, %r14 mov $98, %rcx rep movsw nop nop nop add %rdi, %rdi lea addresses_D_ht+0x1d31d, %rcx nop nop cmp $10839, %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm1 movups %xmm1, (%rcx) nop nop nop nop nop inc %rdx lea addresses_A_ht+0x1a65d, %rdi nop nop nop nop add $50076, %rsi movb $0x61, (%rdi) nop nop nop nop nop xor %r14, %r14 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %rax push %rcx push %rdi // Faulty Load lea addresses_WC+0x1097d, %rax nop nop nop nop add $19771, %rdi mov (%rax), %cx lea oracles, %r11 and $0xff, %rcx shlq $12, %rcx mov (%r11,%rcx,1), %rcx pop %rdi pop %rcx pop %rax pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_WC', 'size': 2, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
// This test is intended to check basic operations with SYCL 2020 specialization // constants using sycl::handler and sycl::kernel_handler APIs: // - test that specialization constants can be accessed in kernel and they // have their default values if `set_specialization_constants` wasn't called // - test that specialization constant values can be set and retrieved within // command group scope // - test that specialization constant values can be set within command group // scope and correctly retrieved within a kernel // // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out \ // RUN: -fsycl-dead-args-optimization // FIXME: SYCL 2020 specialization constants are not supported on host device // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // FIXME: ACC devices use emulation path, which is not yet supported // FIXME: CUDA uses emulation path, which is not yet supported // UNSUPPORTED: cuda || hip #include <cstdlib> #include <iostream> #include <sycl/sycl.hpp> #include "common.hpp" constexpr sycl::specialization_id<int> int_id; constexpr sycl::specialization_id<int> int_id2(2); constexpr sycl::specialization_id<double> double_id(3.14); constexpr sycl::specialization_id<custom_type> custom_type_id; class TestDefaultValuesKernel; class EmptyKernel; class TestSetAndGetOnDevice; bool test_default_values(sycl::queue q); bool test_set_and_get_on_host(sycl::queue q); bool test_set_and_get_on_device(sycl::queue q); int main() { auto exception_handler = [&](sycl::exception_list exceptions) { for (std::exception_ptr const &e : exceptions) { try { std::rethrow_exception(e); } catch (sycl::exception const &e) { std::cout << "An async SYCL exception was caught: " << e.what() << std::endl; std::exit(1); } } }; sycl::queue q(exception_handler); if (!test_default_values(q)) { std::cout << "Test for default values of specialization constants failed!" << std::endl; return 1; } if (!test_set_and_get_on_host(q)) { std::cout << "Test for set and get API on host failed!" << std::endl; return 1; } if (!test_set_and_get_on_device(q)) { std::cout << "Test for set and get API on device failed!" << std::endl; return 1; } return 0; }; bool test_default_values(sycl::queue q) { sycl::buffer<int> int_buffer(1); sycl::buffer<int> int_buffer2(1); sycl::buffer<double> double_buffer(1); sycl::buffer<custom_type> custom_type_buffer(1); q.submit([&](sycl::handler &cgh) { auto int_acc = int_buffer.get_access<sycl::access::mode::write>(cgh); auto int_acc2 = int_buffer2.get_access<sycl::access::mode::write>(cgh); auto double_acc = double_buffer.get_access<sycl::access::mode::write>(cgh); auto custom_type_acc = custom_type_buffer.get_access<sycl::access::mode::write>(cgh); cgh.single_task<TestDefaultValuesKernel>([=](sycl::kernel_handler kh) { int_acc[0] = kh.get_specialization_constant<int_id>(); int_acc2[0] = kh.get_specialization_constant<int_id2>(); double_acc[0] = kh.get_specialization_constant<double_id>(); custom_type_acc[0] = kh.get_specialization_constant<custom_type_id>(); }); }); auto int_acc = int_buffer.get_access<sycl::access::mode::read>(); if (!check_value( 0, int_acc[0], "integer specialization constant (defined without default value)")) return false; auto int_acc2 = int_buffer2.get_access<sycl::access::mode::read>(); if (!check_value(2, int_acc2[0], "integer specialization constant")) return false; auto double_acc = double_buffer.get_access<sycl::access::mode::read>(); if (!check_value(3.14, double_acc[0], "double specialization constant")) return false; auto custom_type_acc = custom_type_buffer.get_access<sycl::access::mode::read>(); const custom_type custom_type_ref; if (!check_value(custom_type_ref, custom_type_acc[0], "custom_type specialization constant")) return false; return true; } bool test_set_and_get_on_host(sycl::queue q) { unsigned errors = 0; q.submit([&](sycl::handler &cgh) { if (!check_value( 0, cgh.get_specialization_constant<int_id>(), "integer specializaiton constant before setting any value")) ++errors; if (!check_value(3.14, cgh.get_specialization_constant<double_id>(), "double specializaiton constant before setting any value")) ++errors; custom_type custom_type_ref; if (!check_value( custom_type_ref, cgh.get_specialization_constant<custom_type_id>(), "custom_type specializaiton constant before setting any value")) ++errors; int new_int_value = 8; double new_double_value = 3.0; custom_type new_custom_type_value('b', 1.0, 12); cgh.set_specialization_constant<int_id>(new_int_value); cgh.set_specialization_constant<double_id>(new_double_value); cgh.set_specialization_constant<custom_type_id>(new_custom_type_value); if (!check_value( new_int_value, cgh.get_specialization_constant<int_id>(), "integer specializaiton constant after setting a new value")) ++errors; if (!check_value( new_double_value, cgh.get_specialization_constant<double_id>(), "double specializaiton constant after setting a new value")) ++errors; if (!check_value( new_custom_type_value, cgh.get_specialization_constant<custom_type_id>(), "custom_type specializaiton constant after setting a new value")) ++errors; cgh.single_task<EmptyKernel>([=]() {}); }); return errors == 0; } bool test_set_and_get_on_device(sycl::queue q) { sycl::buffer<int> int_buffer(1); sycl::buffer<int> int_buffer2(1); sycl::buffer<double> double_buffer(1); sycl::buffer<custom_type> custom_type_buffer(1); int new_int_value = 8; int new_int_value2 = 0; double new_double_value = 3.0; custom_type new_custom_type_value('b', 1.0, 12); q.submit([&](sycl::handler &cgh) { auto int_acc = int_buffer.get_access<sycl::access::mode::write>(cgh); auto int_acc2 = int_buffer2.get_access<sycl::access::mode::write>(cgh); auto double_acc = double_buffer.get_access<sycl::access::mode::write>(cgh); auto custom_type_acc = custom_type_buffer.get_access<sycl::access::mode::write>(cgh); cgh.set_specialization_constant<int_id>(new_int_value); cgh.set_specialization_constant<int_id2>(new_int_value2); cgh.set_specialization_constant<double_id>(new_double_value); cgh.set_specialization_constant<custom_type_id>(new_custom_type_value); cgh.single_task<TestSetAndGetOnDevice>([=](sycl::kernel_handler kh) { int_acc[0] = kh.get_specialization_constant<int_id>(); int_acc2[0] = kh.get_specialization_constant<int_id2>(); double_acc[0] = kh.get_specialization_constant<double_id>(); custom_type_acc[0] = kh.get_specialization_constant<custom_type_id>(); }); }); auto int_acc = int_buffer.get_access<sycl::access::mode::read>(); if (!check_value(new_int_value, int_acc[0], "integer specialization constant")) return false; auto int_acc2 = int_buffer2.get_access<sycl::access::mode::read>(); if (!check_value(new_int_value2, int_acc2[0], "integer specialization constant")) return false; auto double_acc = double_buffer.get_access<sycl::access::mode::read>(); if (!check_value(new_double_value, double_acc[0], "double specialization constant")) return false; auto custom_type_acc = custom_type_buffer.get_access<sycl::access::mode::read>(); if (!check_value(new_custom_type_value, custom_type_acc[0], "custom_type specialization constant")) return false; return true; }
/* -*- Mode:c++; eval:(c-set-style "BSD"); c-basic-offset:4; indent-tabs-mode:nil; tab-width:8 -*- */ /* This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org> */ #include "WebAppServer.h" #include "WebAppServerInternal.h" #include "base64.h" #include <stdlib.h> #include <errno.h> using namespace std; namespace WebAppServer { #define VERBOSE 1 WebFastCGIConnection :: WebFastCGIConnection( serverPort::ConfigRecList_t &_configs, int _fd) : WebServerConnectionBase(_configs, _fd) { state = STATE_BEGIN; cgiParams = NULL; queryStringParams = NULL; cgiConfig = NULL; time(&lastCall); registeredWaiter = false; } WebFastCGIConnection :: ~WebFastCGIConnection(void) { if (wac && registeredWaiter) { WebAppConnectionDataFastCGI * dat = wac->connData->fcgi(); WaitUtil::Lock lock(dat); dat->waiter = NULL; wac = NULL; } if (cgiParams) delete cgiParams; if (queryStringParams) delete queryStringParams; } //virtual void WebFastCGIConnection :: startServer(void) { // i wanted to startFdThread in WebServerConnectionBase, but i can't // because it would call pure virtual methods that aren't set up until // this derived contructor is complete. so.. bummer. startFdThread(tempFd, 1000); } //virtual bool WebFastCGIConnection :: handleSomeData(void) { while (1) { size_t rbSize = readbuf.size(); if (rbSize < sizeof(FastCGIHeader)) break; // not enough for a header. FastCGIRecord rec; readbuf.copyOut((uint8_t*)&rec.header, 0, sizeof(FastCGIHeader)); if (rec.header.version != FastCGIHeader::VERSION_1) { cerr << "Fast CGI proto version error" << endl; return false; } uint16_t contLen = rec.header.get_contentLength(); uint16_t padLen = rec.header.paddingLength; uint16_t fullLen = contLen + padLen + sizeof(FastCGIHeader); if (fullLen > rbSize) break; // not enough for the body. if (0) cout << "handling record of size " << contLen << endl; if (fullLen > sizeof(FastCGIRecord)) { cerr << "FastCGI record overflow!" << endl; return false; } readbuf.copyOut((uint8_t*)&rec.body, sizeof(FastCGIHeader), contLen); if (handleRecord(&rec) == false) return false; readbuf.erase0(fullLen); } return true; } //virtual bool WebFastCGIConnection :: doPoll(void) { time_t now = time(NULL); if (wac && wac->connData && wac->connData->fcgi()) { wac->connData->fcgi()->lastCall = now; } int idleTime = now - lastCall; if (idleTime > maxIdleTime) return false; return true; } //virtual void WebFastCGIConnection :: done(void) { // wac is not deleted because it lives beyond // this ephemeral connection. we do however deregister ourselves // from the wac's "waiter" pointer. if (wac && registeredWaiter) { WebAppConnectionDataFastCGI * dat = wac->connData->fcgi(); WaitUtil::Lock lock(dat); dat->waiter = NULL; wac = NULL; } deleteMe = true; } static void doPercentSubstitute(CircularReaderSubstr &str) { size_t pos = 0; while (pos != string::npos) { int pc = str.find("%",pos); if (pc == CircularReaderSubstr::npos) break; char hex[3]; hex[0] = str[pc+1]; hex[1] = str[pc+2]; hex[2] = 0; char c = (char) strtoul(hex,NULL,16); str[pc] = c; str.erase(pc+1,2); pos = pc+1; } } FastCGIParam :: FastCGIParam(const CircularReaderSubstr &_name, const CircularReaderSubstr &_value, bool percentSubstitute /*=false*/) : name(_name), value(_value) { if (percentSubstitute) { doPercentSubstitute(name); doPercentSubstitute(value); } } FastCGIParam :: ~FastCGIParam(void) { } FastCGIParamsList :: FastCGIParamsList(void) { } FastCGIParamsList :: FastCGIParamsList(const CircularReaderSubstr &queryString) { int namePos = 0, valuePos, eqPos, ampPos; if (queryString.size() == 0) return; paramBuffer = queryString; while (namePos != CircularReaderSubstr::npos) { CircularReaderSubstr name, value; eqPos = paramBuffer.find("=", namePos); if (eqPos == CircularReaderSubstr::npos) { // if no '=', then add one variable whose // name is the whole querystring, with no value, // and bail. name = paramBuffer; namePos = CircularReaderSubstr::npos; } else { name = paramBuffer.substr(namePos,eqPos-namePos); valuePos = eqPos+1; ampPos = paramBuffer.find("&", eqPos); if (ampPos != CircularReaderSubstr::npos) { // found an '&'. value = paramBuffer.substr(valuePos,ampPos-valuePos); namePos = ampPos+1; } else { // there was no '&', so this variable's value // is the rest of the queryString, and bail. value = paramBuffer.substr(valuePos); namePos = CircularReaderSubstr::npos; } } params[name] = new FastCGIParam(name,value,true); } } FastCGIParamsList :: ~FastCGIParamsList(void) { FastCGIParamsList::paramIter_t it; for (it = params.begin(); it != params.end(); it++) { FastCGIParam * p = it->second; delete p; params.erase(it); } } int getFieldLen(const CircularReaderSubstr &data, int &pos, int &remaining) { int nameLen = data[pos]; if ((nameLen & 0x80) == 0x80) { // this is a 32-bit length, not an 8-bit length. if (remaining < 4) { cerr << "getFieldLen: not enough space for 32-bit len" << endl; return 0xFFFFFFFF; } nameLen = ((((uint8_t)data[pos+0]) & 0x7f) << 24) | ( ((uint8_t)data[pos+1]) << 16) | ( ((uint8_t)data[pos+2]) << 8) | ((uint8_t)data[pos+3]); pos += 4; remaining -= 4; } else { pos += 1; remaining -= 1; } return nameLen; } FastCGIParamsList * FastCGIParams :: getParams(uint16_t length) const { FastCGIParamsList * ret = new FastCGIParamsList; CircularReader &data = ret->paramBuffer; data.assign((uint8_t*)rawdata, (int)length); int pos = 0; int remaining = (int)length; while (pos < length) { int nameLen, valueLen; nameLen = getFieldLen(data, pos, remaining); if (nameLen < 0) break; valueLen = getFieldLen(data, pos, remaining); if (valueLen < 0) break; if (remaining < nameLen) // cast to remove warning { cerr << "getParams: not enough space for name" << endl; goto fail; } CircularReaderSubstr fieldName = data.substr(pos, nameLen); pos += nameLen; remaining -= nameLen; CircularReaderSubstr fieldValue = data.substr(pos, valueLen); pos += valueLen; ret->params[fieldName] = new FastCGIParam(fieldName,fieldValue); } return ret; fail: delete ret; return NULL; } bool WebFastCGIConnection :: handleRecord(const FastCGIRecord *rec) { bool ret = true; if (0) printRecord(rec); switch (rec->header.type) { case FastCGIHeader::BEGIN_REQ: ret = handleBegin(rec); break; case FastCGIHeader::ABORT_REQ: cout << "got ABORT" << endl; ret = false; break; case FastCGIHeader::END_REQ: cout << "got END request" << endl; ret = false; break; case FastCGIHeader::STDIN: ret = handleStdin(rec); break; case FastCGIHeader::PARAMS: ret = handleParams(rec); break; default: cout << "got unhandled record:" << endl; printRecord(rec); } return ret; } bool WebFastCGIConnection :: handleBegin(const FastCGIRecord *rec) { if (state != STATE_BEGIN) { cerr << "WebFastCGIConnection does not support multiplexing" << endl; FastCGIRecord resp; resp.header.type = FastCGIHeader::END_REQ; resp.header.set_requestId(rec->header.get_requestId()); resp.header.set_contentLength(sizeof(FastCGIEnd)); resp.body.end.set_appStatus(0); resp.body.end.protocolStatus = FastCGIEnd::STATUS_CANT_MULTIPLEX; sendRecord(resp); return false; } else { requestId = rec->header.get_requestId(); uint16_t role = rec->body.begin.get_role(); if (role != FastCGIBegin::ROLE_RESPONDER) { cout << "unsupported fastcgi role " << role << endl; return false; } state = STATE_PARAMS; if (0) cout << "got cgi begin record" << endl; } return true; } bool WebFastCGIConnection :: handleParams(const FastCGIRecord *rec) { if (state != STATE_PARAMS) { cerr << "fastcgi protocol error: not in PARAMS state" << endl; return false; } uint16_t contentLength = rec->header.get_contentLength(); if (contentLength == 0) { if (0) cout << "got zero length params, moving to INPUT state" << endl; state = STATE_INPUT; stdinBuffer.clear(); return startWac(); } if (0) cout << "got Params record of length " << contentLength << endl; cgiParams = rec->body.params.getParams( rec->header.get_contentLength()); FastCGIParamsList::paramIter_t it; for (it = cgiParams->params.begin(); it != cgiParams->params.end(); it++) { FastCGIParam * p = it->second; if (VERBOSE) cout << "param: " << p->name << " = " << p->value << endl; } it = cgiParams->params.find(CircularReader("QUERY_STRING")); if (it != cgiParams->params.end()) { FastCGIParam * qs = it->second; queryStringParams = new FastCGIParamsList(qs->value); for (it = queryStringParams->params.begin(); it != queryStringParams->params.end(); it++) { FastCGIParam * p = it->second; if (VERBOSE) cout << "param: " << p->name << " = " << p->value << endl; } } return true; } bool WebFastCGIConnection :: handleStdin(const FastCGIRecord *rec) { if (state != STATE_INPUT) { cerr << "fastcgi protocol error: not in INPUT state" << endl; return false; } uint16_t contentLength = rec->header.get_contentLength(); if (contentLength == 0) { if (VERBOSE) cout << "got end of input, decoding" << endl; if (stdinBuffer.length() > 0) if (decodeInput() == false) return false; if (VERBOSE) cout << "switching to OUTPUT" << endl; return startOutput(); } if (VERBOSE) cout << "got stdin record of length " << contentLength << endl; printRecord(rec); stdinBuffer.append( rec->body.text, rec->header.get_contentLength() ); return true; } void WebFastCGIConnection :: printRecord(const FastCGIRecord *rec) { uint8_t * header = (uint8_t*) &rec->header; uint8_t * body = (uint8_t*) &rec->body; uint16_t bodylen = rec->header.get_contentLength(); printf("got record:\n"); printf(" header: "); for (uint32_t ctr = 0; ctr < sizeof(rec->header); ctr++) printf("%02x", header[ctr]); printf("\n"); printf(" body: "); for (int ctr = 0; ctr < bodylen; ctr++) printf("%02x", body[ctr]); printf("\n"); } bool WebFastCGIConnection :: sendRecord(const FastCGIRecord &rec) { int writeLen = sizeof(FastCGIHeader) + rec.header.get_contentLength() + rec.header.paddingLength; int cc = ::write(fd, &rec, writeLen); if (cc != writeLen) return false; return true; } //virtual void WebFastCGIConnection :: sendMessage(const WebAppMessage &m) { FastCGIRecord mimeHeaders; mimeHeaders.header.version = FastCGIHeader::VERSION_1; mimeHeaders.header.type = FastCGIHeader::STDOUT; mimeHeaders.header.paddingLength = 0; mimeHeaders.header.reserved = 0; mimeHeaders.header.set_requestId(requestId); if (m.buf.length() > sizeof(mimeHeaders.body.text)) { cout << "WebFastCGIConnection :: sendMessage : BOUNDS CHECK" << endl; } else { memcpy(mimeHeaders.body.text, m.buf.c_str(), m.buf.length()); mimeHeaders.header.set_contentLength( m.buf.length() ); printRecord(&mimeHeaders); // we really don't care about return value, because // in either case we're returning 'false' from the sender // to close the connection and complete the transaction // to the browser. (void) sendRecord(mimeHeaders); } stopFdThread(); } bool WebFastCGIConnection :: startWac(void) { FastCGIParamsList::paramIter_t paramit = cgiParams->params.find(CircularReader("DOCUMENT_URI")); if (paramit == cgiParams->params.end()) { cerr << "DOCUMENT_URI is not set?!" << endl; return false; } resource = paramit->second->value.toString(); if (findResource() == false) { cerr << "no handler installed for path: " << resource << endl; return false; } if (VERBOSE) cout << "found handler for path: " << resource << endl; cgiConfig = dynamic_cast<WebAppServerFastCGIConfigRecord*>(config); if (cgiConfig == NULL) { cerr << "invalid config, config rec is not a fastCgi config rec!" << endl; return false; } string visitorId; paramit = cgiParams->params.find(CircularReader("HTTP_COOKIE")); if (paramit != cgiParams->params.end()) { FastCGIParam * p = paramit->second; if (VERBOSE) cout << "cookie: " << p->value << endl; size_t visitorIdNamePos = p->value.find("visitorId="); if (visitorIdNamePos != string::npos) { visitorIdNamePos += 10; // length of "visitorId=" int semicolonOrEndPos = p->value.find_first_of(';',visitorIdNamePos); visitorId = p->value.toString(visitorIdNamePos,semicolonOrEndPos); } } cookieString.clear(); if (visitorId.length() == 0) { if (VERBOSE) cout << "found no visitor Id, generating one" << endl; generateNewVisitorId(visitorId); cookieString = "Set-Cookie: visitorId="; cookieString.append(visitorId); cookieString += "; path=/\r\n"; } else { if (VERBOSE) cout << "found visitor id : " << visitorId << endl; } WebAppServerFastCGIConfigRecord::ConnListIter_t visitorIt; { WaitUtil::Lock lock(cgiConfig); visitorIt = cgiConfig->conns.find(visitorId); if (visitorIt == cgiConfig->conns.end()) { // make a new one wac = config->cb->newConnection(); wac->connData = new WebAppConnectionDataFastCGI; wac->onConnect(); cgiConfig->conns[visitorId] = wac; if (VERBOSE) cout << "made a new wac" << endl; } else { wac = visitorIt->second; if (VERBOSE) cout << "found existing wac" << endl; } // timestamp it for idle detection wac->connData->fcgi()->lastCall = time(NULL); } return true; } bool WebFastCGIConnection :: decodeInput(void) { int left = stdinBuffer.length(); if (left < 4) { cout << "WebFastCGIConnection :: decodeInput : len " << left << " too short" << endl; return false; } const char * inbuf = stdinBuffer.c_str(); std::string decodeBuf; int inpos = 0; for (inpos = 0; left >= 4; left -= 4, inpos += 4) { unsigned char out3[3]; int decodeLen = b64_decode_quantum(inbuf + inpos, out3); if (decodeLen < 0) { cout << "bogus base64 data" << endl; return false; } decodeBuf.append((char*)out3, decodeLen); } const WebAppMessage m(WS_TYPE_BINARY, decodeBuf); if (wac->onMessage(m) == false) return false; return true; } bool WebFastCGIConnection :: startOutput(void) { state = STATE_OUTPUT; time(&lastCall); { FastCGIRecord mimeHeaders; mimeHeaders.header.version = FastCGIHeader::VERSION_1; mimeHeaders.header.type = FastCGIHeader::STDOUT; mimeHeaders.header.paddingLength = 0; mimeHeaders.header.reserved = 0; mimeHeaders.header.set_requestId(requestId); int len = snprintf(mimeHeaders.body.text, sizeof(mimeHeaders.body.text), "HTTP/1.1 200 OK\r\n" "Content-Type: text/ascii\r\n" "%s\r\n", cookieString.c_str()); mimeHeaders.header.set_contentLength( len ); printRecord(&mimeHeaders); if (sendRecord(mimeHeaders) == false) return false; } FastCGIParamsList::paramIter_t it; it = cgiParams->params.find(CircularReader("REQUEST_METHOD")); if (it != cgiParams->params.end()) { FastCGIParam * qs = it->second; cout << "REQUEST_METHOD value is " << qs->value << endl; if (qs->value == "POST") { // we're done here, no output. there's a separate // GET connection for messages going the other way. return false; } } /* if there is a message queued, send it here and return false to close the connection so the client gets it. if there is no message queued, return true. */ WebAppConnectionDataFastCGI * dat = wac->connData->fcgi(); WaitUtil::Lock lock(dat); if (dat->outq.size() > 0) { dat->sendFrontMessage(this); } else { // queue is empty // last question. did we set a cookie? if so, better // let that complete immediately. we can't have that // timing out at the client and being ignored. if (cookieString.size() > 0) { cout << "ending GET with zero data in order to set cookie" << endl; return false; } state = STATE_BLOCKED; registeredWaiter = true; dat->waiter = this; return true; } return false; } void WebFastCGIConnection :: generateNewVisitorId( std::string &visitorId) { static const char randChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; static const int numRandChars = sizeof(randChars)-1; // minus nul while (1) { visitorId.clear(); for (int cnt = 0; cnt < visitorCookieLen; cnt++) visitorId.push_back(randChars[random() % numRandChars]); cout << "trying visitorId " << visitorId << endl; { WaitUtil::Lock lock(cgiConfig); if (cgiConfig->conns.find(visitorId) == cgiConfig->conns.end()) return; } // generated a visitorId that already exists; go round again. } } void WebAppConnectionDataFastCGI :: sendMessage(const WebAppMessage &m) { int quant = 0, left = m.buf.size(); if (left == 0) { cerr << "WebFastCGIConnection :: sendMessage : size=0? no." << endl; return; } std::string b64_str; // calculate number of b64 encoded quanta are // needed to encode a binary string. b64_str.resize((((left-1)/3)+1)*4); unsigned char * inbuf = (unsigned char *) m.buf.c_str(); char * outbuf = (char*) b64_str.c_str(); for (quant = 0; left > 0; quant++, left -= 3) { b64_encode_quantum(inbuf + (quant*3), (left >= 3) ? 3 : left, outbuf + (quant*4)); } WaitUtil::Lock lock(this); outq.push_back(b64_str); if (waiter) { sendFrontMessage(waiter); waiter = NULL; } } // this object should be locked before calling this. void WebAppConnectionDataFastCGI :: sendFrontMessage( WebFastCGIConnection * _waiter) { const WebAppMessage m(WS_TYPE_BINARY, outq.front()); _waiter->sendMessage(m); outq.pop_front(); } WebAppServerFastCGIConfigRecord :: WebAppServerFastCGIConfigRecord( WebAppType _type, int _port, const std::string _route, WebAppConnectionCallback *_cb, int _pollInterval, int _msgTimeout ) : WebAppServerConfigRecord(_type,_port,_route,_cb,_pollInterval, _msgTimeout) { if (pollInterval > 0) { if (pipe(closePipe) < 0) { fprintf(stderr, "WebAppServerFastCGIConfigRecord: " "unable to create closePipe: %d (%s)\n", errno, strerror(errno)); // should probably do something else here } else { pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); pthread_create(&thread_id, &attr, &_thread_entry, (void*) this); pthread_attr_destroy(&attr); } } } WebAppServerFastCGIConfigRecord :: ~WebAppServerFastCGIConfigRecord(void) { if (pollInterval > 0) { WaitUtil::Lock lock(this); close(closePipe[1]); void * dummy; pthread_join(thread_id, &dummy); close(closePipe[0]); } } //static void * WebAppServerFastCGIConfigRecord :: _thread_entry(void * me) { WebAppServerFastCGIConfigRecord * obj = (WebAppServerFastCGIConfigRecord *) me; obj->thread_entry(); return NULL; } void WebAppServerFastCGIConfigRecord :: thread_entry(void) { while (1) { struct timeval tv; fd_set rfds; tv.tv_sec = pollInterval / 1000; tv.tv_usec = pollInterval % 1000; FD_ZERO(&rfds); FD_SET(closePipe[0], &rfds); if (select(closePipe[0]+1, &rfds, NULL, NULL, &tv) > 0) break; time_t now = time(NULL); WaitUtil::Lock lock(this); ConnListIter_t it; for (it = conns.begin(); it != conns.end(); it++) { WebAppConnection * wac = it->second; bool nukeIt = false; if (wac->doPoll() == false) nukeIt = true; else { int idleTime = now - wac->connData->fcgi()->lastCall; if (idleTime > WebAppConnectionDataFastCGI::maxIdleTime) nukeIt = true; } if (nukeIt) { // private wac->connData->fcgi()->lock(); wac->onDisconnect(); delete wac; conns.erase(it); } } } } } // namespace WebAppServer
;/* ; FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd. ; All rights reserved ; ; ; *************************************************************************** ; * * ; * FreeRTOS tutorial books are available in pdf and paperback. * ; * Complete, revised, and edited pdf reference manuals are also * ; * available. * ; * * ; * Purchasing FreeRTOS documentation will not only help you, by * ; * ensuring you get running as quickly as possible and with an * ; * in-depth knowledge of how to use FreeRTOS, it will also help * ; * the FreeRTOS project to continue with its mission of providing * ; * professional grade, cross platform, de facto standard solutions * ; * for microcontrollers - completely free of charge! * ; * * ; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * ; * * ; * Thank you for using FreeRTOS, and thank you for your support! * ; * * ; *************************************************************************** ; ; ; This file is part of the FreeRTOS distribution. ; ; FreeRTOS is free software; you can redistribute it and/or modify it under ; the terms of the GNU General Public License (version 2) as published by the ; Free Software Foundation AND MODIFIED BY the FreeRTOS exception. ; >>>NOTE<<< The modification to the GPL is included to allow you to ; distribute a combined work that includes FreeRTOS without being obliged to ; provide the source code for proprietary components outside of the FreeRTOS ; kernel. FreeRTOS is distributed in the hope that it will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ; more details. You should have received a copy of the GNU General Public ; License and the FreeRTOS license exception along with FreeRTOS; if not it ; can be viewed here: http://www.freertos.org/a00114.html and also obtained ; by writing to Richard Barry, contact details for whom are available on the ; FreeRTOS WEB site. ; ; 1 tab == 4 spaces! ; ; http://www.FreeRTOS.org - Documentation, latest information, license and ; contact details. ; ; http://www.SafeRTOS.com - A version that is certified for use in safety ; critical systems. ; ; http://www.OpenRTOS.com - Commercial support, development, porting, ; licensing and training services. ;*/ .sect ".kernelTEXT" .arm .ref vTaskSwitchContext .ref xTaskIncrementTick .ref ulTaskHasFPUContext .ref pxCurrentTCB .ref ulCriticalNesting; ;/*-----------------------------------------------------------*/ ; ; Save Task Context ; portSAVE_CONTEXT .macro DSB ; Push R0 as we are going to use it STMDB SP!, {R0} ; Set R0 to point to the task stack pointer. SUB SP, SP, #4 STMDA SP,{SP}^ LDMIA SP!,{R0} ; Push the return address onto the stack. STMDB R0!, {LR} ; Now LR has been saved, it can be used instead of R0. MOV LR, R0 ; Pop R0 so it can be saved onto the task stack. LDMIA SP!, {R0} ; Push all the system mode registers onto the task stack. STMDB LR,{R0-LR}^ SUB LR, LR, #60 ; Push the SPSR onto the task stack. MRS R0, SPSR STMDB LR!, {R0} ;Determine if the task maintains an FPU context. LDR R0, ulFPUContextConst LDR R0, [R0] ; Test the flag CMP R0, #0 ; If the task is not using a floating point context then skip the ; saving of the FPU registers. BEQ $+16 FSTMDBD LR!, {D0-D15} FMRX R1, FPSCR STMFD LR!, {R1} ; Save the flag STMDB LR!, {R0} ; Store the new top of stack for the task. LDR R0, pxCurrentTCBConst LDR R0, [R0] STR LR, [R0] .endm ;/*-----------------------------------------------------------*/ ; ; Restore Task Context ; portRESTORE_CONTEXT .macro LDR R0, pxCurrentTCBConst LDR R0, [R0] ; task stack MPU region mov r4, #5 ; Task Stack Region add r12, r0, #4 ; poin to regions in TCB ldmia r12!, {r1-r3} mcr p15, #0, r4, c6, c2, #0 ; Select region mcr p15, #0, r1, c6, c1, #0 ; Base Address mcr p15, #0, r3, c6, c1, #4 ; Access Attributes mcr p15, #0, r2, c6, c1, #2 ; Size and Enable ldr r5, portMax_MPU_Region mov r4, #6 ; dynamic MPU per task ldmia r12!, {r1-r3} mcr p15, #0, r4, c6, c2, #0 ; Select region mcr p15, #0, r1, c6, c1, #0 ; Base Address mcr p15, #0, r3, c6, c1, #4 ; Access Attributes mcr p15, #0, r2, c6, c1, #2 ; Size and Enable add r4, r4, #1 cmp r4, r5 bne $ - 0x1C LDR LR, [R0] ; The floating point context flag is the first thing on the stack. LDR R0, ulFPUContextConst LDMFD LR!, {R1} STR R1, [R0] ; Test the flag CMP R1, #0 ; If the task is not using a floating point context then skip the ; VFP register loads. BEQ $+16 ; Restore the floating point context. LDMFD LR!, {R0} FLDMIAD LR!, {D0-D15} FMXR FPSCR, R0 ; Get the SPSR from the stack. LDMFD LR!, {R0} MSR SPSR_CSXF, R0 ; Restore all system mode registers for the task. LDMFD LR, {R0-R14}^ ; Restore the return address. LDR LR, [LR, #+60] DSB ; And return - correcting the offset in the LR to obtain the ; correct address. SUBS PC, LR, #4 .endm portMax_MPU_Region .word 12 - 1 ;/*-----------------------------------------------------------*/ ; Start the first task by restoring its context. .def vPortStartFirstTask .asmfunc vPortStartFirstTask cps #0x13 portRESTORE_CONTEXT .endasmfunc ;/*-----------------------------------------------------------*/ ; Yield to another task. .def vPortYieldProcessor .asmfunc swiPortYield ; Restore stack and LR before calling vPortYieldProcessor ldmfd sp!, {r11,r12,lr} vPortYieldProcessor ; Within an IRQ ISR the link register has an offset from the true return ; address. SWI doesn't do this. Add the offset manually so the ISR ; return code can be used. ADD LR, LR, #4 ; First save the context of the current task. portSAVE_CONTEXT ; Select the next task to execute. */ BL vTaskSwitchContext ; Restore the context of the task selected to execute. portRESTORE_CONTEXT .endasmfunc ;/*-----------------------------------------------------------*/ ; Yield to another task from within the FreeRTOS API .def vPortYeildWithinAPI .asmfunc vPortYeildWithinAPI ; Save the context of the current task. portSAVE_CONTEXT ; Clear SSI flag. MOVW R0, #0xFFF4 MOVT R0, #0xFFFF LDR R0, [R0] ; Select the next task to execute. */ BL vTaskSwitchContext ; Restore the context of the task selected to execute. portRESTORE_CONTEXT .endasmfunc ;/*-----------------------------------------------------------*/ ; Preemptive Tick .def vPortPreemptiveTick .asmfunc vPortPreemptiveTick ; Save the context of the current task. portSAVE_CONTEXT ; Clear interrupt flag MOVW R0, #0xFC88 MOVT R0, #0xFFFF MOV R1, #1 STR R1, [R0] ; Increment the tick count, making any adjustments to the blocked lists ; that may be necessary. BL xTaskIncrementTick ; Select the next task to execute. CMP R0, #0 BLNE vTaskSwitchContext ; Restore the context of the task selected to execute. portRESTORE_CONTEXT .endasmfunc ;------------------------------------------------------------------------------- .def vPortInitialiseFPSCR vPortInitialiseFPSCR MOV R0, #0 FMXR FPSCR, R0 BX LR ;------------------------------------------------------------------------------- .def ulPortCountLeadingZeros .asmfunc ulPortCountLeadingZeros CLZ R0, R0 BX LR .endasmfunc ;------------------------------------------------------------------------------- ; SWI Handler, interface to Protected Mode Functions .def vPortSWI .asmfunc vPortSWI stmfd sp!, {r11,r12,lr} ldrb r12, [lr, #-1] ldr r14, table ldr r12, [r14, r12, lsl #2] blx r12 ldmfd sp!, {r11,r12,pc}^ table .word jumpTable jumpTable .word swiPortYield ; 0 - vPortYieldProcessor .word swiRaisePrivilege ; 1 - Raise Priviledge .word swiPortEnterCritical ; 2 - vPortEnterCritical .word swiPortExitCritical ; 3 - vPortExitCritical .word swiPortTaskUsesFPU ; 4 - vPortTaskUsesFPU .word swiPortDisableInterrupts ; 5 - vPortDisableInterrupts .word swiPortEnableInterrupts ; 6 - vPortEnableInterrupts .endasmfunc ;------------------------------------------------------------------------------- ; swiPortDisableInterrupts .asmfunc swiPortDisableInterrupts mrs r11, SPSR orr r11, r11, #0x80 msr SPSR_c, r11 bx r14 .endasmfunc ;------------------------------------------------------------------------------- ; swiPortEnableInterrupts .asmfunc swiPortEnableInterrupts mrs r11, SPSR bic r11, r11, #0x80 msr SPSR_c, r11 bx r14 .endasmfunc ;------------------------------------------------------------------------------- ; swiPortTaskUsesFPU .asmfunc swiPortTaskUsesFPU ldr r12, ulTaskHasFPUContextConst mov r11, #1 str r11, [r12] mov r11, #0 fmxr FPSCR, r11 bx r14 .endasmfunc ;------------------------------------------------------------------------------- ; swiRaisePrivilege ; Must return zero in R0 if caller was in user mode .asmfunc swiRaisePrivilege mrs r12, spsr ands r0, r12, #0x0F ; return value orreq r12, r12, #0x1F msreq spsr_c, r12 bx r14 .endasmfunc ;------------------------------------------------------------------------------- ; swiPortEnterCritical .asmfunc swiPortEnterCritical mrs r11, SPSR orr r11, r11, #0x80 msr SPSR_c, r11 ldr r11, ulCriticalNestingConst ldr r12, [r11] add r12, r12, #1 str r12, [r11] bx r14 .endasmfunc ;------------------------------------------------------------------------------- ; swiPortExitCritical .asmfunc swiPortExitCritical ldr r11, ulCriticalNestingConst ldr r12, [r11] cmp r12, #0 bxeq r14 subs r12, r12, #1 str r12, [r11] bxne r14 mrs r11, SPSR bic r11, r11, #0x80 msr SPSR_c, r11 bx r14 .endasmfunc ;------------------------------------------------------------------------------- ; SetRegion .def prvMpuSetRegion .asmfunc ; void _mpuSetRegion(unsigned region, unsigned base, unsigned size, unsigned access); prvMpuSetRegion and r0, r0, #15 ; select region mcr p15, #0, r0, c6, c2, #0 mcr p15, #0, r1, c6, c1, #0 ; Base Address mcr p15, #0, r3, c6, c1, #4 ; Access Attributes mcr p15, #0, r2, c6, c1, #2 ; Size and Enable bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Enable Mpu .def prvMpuEnable .asmfunc prvMpuEnable mrc p15, #0, r0, c1, c0, #0 orr r0, r0, #1 dsb mcr p15, #0, r0, c1, c0, #0 isb bx lr .endasmfunc ;------------------------------------------------------------------------------- ; Disable Mpu .def prvMpuDisable .asmfunc prvMpuDisable mrc p15, #0, r0, c1, c0, #0 bic r0, r0, #1 dsb mcr p15, #0, r0, c1, c0, #0 isb bx lr .endasmfunc ;------------------------------------------------------------------------------- pxCurrentTCBConst .word pxCurrentTCB ulFPUContextConst .word ulTaskHasFPUContext ulCriticalNestingConst .word ulCriticalNesting ulTaskHasFPUContextConst .word ulTaskHasFPUContext ;-------------------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1993 -- All Rights Reserved PROJECT: PC GEOS MODULE: Printer Drivers FILE: streamControlByteOutRedwood.asm AUTHOR: Dave Durran ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 1/93 Initial version DESCRIPTION: contains the routines to write commands to the gate array in the Redwood devices $Id: streamControlByteOutRedwood.asm,v 1.1 97/04/18 11:49:32 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ControlByteOut %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Send out a control code byte. CALLED BY: INTERNAL PASS: es - PState segment al - byte to send out. RETURN: carry clear DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 01/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ControlByteOut proc near uses ax,bx,dx .enter mov ah,al mov dx,es:[PS_redwoodSpecific].RS_gateArrayBase add dx,HST1 ;point at status reg. push ax call TimerGetCount ;ax --> low word of count. add ax,WATCHDOG_COUNT_INIT ;add standard wait time. mov es:[PS_redwoodSpecific].RS_watchDogCount,ax pop ax testLoop: call HardwareDelayLoop in al,dx ;get the status byte. test al,mask HST1_HDBSY ;see if ready for data. jz tested push ax call TimerGetCount ;ax --> low word of count. cmp ax,es:[PS_redwoodSpecific].RS_watchDogCount pop ax je error jmp testLoop tested: ;point back at data reg. mov dx,es:[PS_redwoodSpecific].RS_gateArrayBase mov al,ah ;get the byte of data call HardwareDelayLoop out dx,al ;stuff the data reg. clc exit: .leave ret error: stc jmp exit ControlByteOut endp
; ------------------------------------------------------------ ; Arquivo: Mod.nasm ; Curso: Elementos de Sistemas ; Criado por: Luciano Soares ; Data: 27/03/2017 ; ; Calcula o resto da divisão (modulus) entre RAM[0] por RAM[1] ; e armazena o resultado na RAM[2]. ; ; 4 % 3 = 1 ; 10 % 7 = 3 ; ------------------------------------------------------------ leaw $0, %A movw (%A), %D leaw $2, %A movw %D, (%A) LOOP: leaw $1, %A movw (%A), %D leaw $2, %A subw (%A), %D, %D leaw $2, %A movw %D, (%A) leaw $1, %A subw %D, (%A), %D leaw $LOOP, %A jg %D nop
; A316533: a(n) is the Sprague-Grundy value of the Node-Kayles game played on the generalized Petersen graph P(n,2). ; 1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0 mov $1,1 mov $2,$0 lpb $2 mov $1,$4 sub $2,1 add $6,$2 lpb $5 sub $5,$3 add $6,3 lpe lpb $6 sub $2,1 trn $2,5 mov $5,$3 mov $6,4 lpe add $1,$2 trn $2,1 mov $3,6 add $5,$6 trn $6,6 lpe
; A193397: Wiener index of a benzenoid consisting of a double-step spiral chain of n hexagons (n>=2, s=21; see the Gutman et al. reference). ; 109,271,553,955,1541,2279,3265,4435,5917,7615,9689,12011,14773,17815,21361,25219,29645,34415,39817,45595,52069,58951,66593,74675,83581,92959,103225,113995,125717,137975,151249,165091,180013,195535,212201,229499,248005,267175,287617,308755,331229,354431,379033,404395,431221,458839,487985,517955,549517,581935,616009,650971,687653,725255,764641,804979,847165,890335,935417,981515,1029589,1078711,1129873,1182115,1236461,1291919,1349545,1408315,1469317,1531495,1595969,1661651,1729693,1798975,1870681,1943659,2019125,2095895,2175217,2255875,2339149,2423791,2511113,2599835,2691301,2784199,2879905,2977075,3077117,3178655,3283129,3389131,3498133,3608695,3722321,3837539,3955885,4075855,4199017,4323835 mov $4,$0 mul $0,2 mov $1,$0 gcd $1,4 mul $0,$1 add $0,109 mov $2,$4 mul $2,110 add $0,$2 mov $3,$4 mul $3,$4 mov $2,$3 mul $2,44 add $0,$2 mul $3,$4 mov $2,$3 mul $2,4 add $0,$2
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1993 -- All Rights Reserved PROJECT: PC GEOS MODULE: IBM Proprinter X24 24-pin printer driver for Zoomer FILE: propx24zDriverInfo.asm AUTHOR: Dave Durran, 26 Mar 1990 REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 3/27/90 Initial revision Dave 5/92 Initial 2.0 version DESCRIPTION: Driver info for the propx 24-pin printer driver The file "printerDriver.def" should be included before this one $Id: propx24jDriverInfo.asm,v 1.1 97/04/18 11:53:46 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Driver Info Resource This part of the file contains the information that pertains to all device supported by the driver. It includes device names and a table of the resource handles for the specific device info. A pointer to this info is provided by the DriverInfo function. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DriverInfo segment lmem LMEM_TYPE_GENERAL ;---------------------------------------------------------------------------- ; Device Enumerations ;---------------------------------------------------------------------------- DefPrinter PD_IBM_PPRINTER_X24, "IBM Proprinter 24-pin", generInfo localize not ;---------------------------------------------------------------------------- ; Driver Info Header ;---------------------------------------------------------------------------- DriverExtendedInfoTable < {}, ; lmem hdr PrintDevice/2, ; # devices offset deviceStrings, ; devices offset deviceInfoTab ; info blocks > PrintDriverInfo < 30, ; timeout (sec) PR_DONT_RESEND, ; isoSubstitutions, ;ISO sub tab. asciiTransTable, PDT_PRINTER, TRUE > ;---------------------------------------------------------------------------- ; Device String Table and Strings ;---------------------------------------------------------------------------- isoSubstitutions chunk.word 0ffffh ;no ISO subs. ; ASCII Translation List for Foreign Language Versions asciiTransTable chunk.char ";;",0 ;create the actual tables here..... PrinterTables DriverInfo ends
; A173184: Partial sums of A000166. ; 1,1,2,4,13,57,322,2176,17009,150505,1485466,16170036,192384877,2483177809,34554278858,515620794592,8212685046337,139062777326001,2494364438359954,47245095998005060 mov $2,$0 mov $3,$0 add $3,1 lpb $3,1 mov $0,$2 sub $3,1 sub $0,$3 mov $4,2 mov $6,3 lpb $0,1 sub $0,1 mov $6,$5 mov $7,$4 mov $4,$5 add $5,$7 mul $5,$0 lpe div $6,2 add $1,$6 lpe
_rm: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: bf 01 00 00 00 mov $0x1,%edi 16: 83 ec 08 sub $0x8,%esp 19: 8b 31 mov (%ecx),%esi 1b: 8b 59 04 mov 0x4(%ecx),%ebx 1e: 83 c3 04 add $0x4,%ebx int i; if(argc < 2){ 21: 83 fe 01 cmp $0x1,%esi 24: 7e 3e jle 64 <main+0x64> 26: 8d 76 00 lea 0x0(%esi),%esi 29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi printf(2, "Usage: rm files...\n"); exit(); } for(i = 1; i < argc; i++){ if(unlink(argv[i]) < 0){ 30: 83 ec 0c sub $0xc,%esp 33: ff 33 pushl (%ebx) 35: e8 d8 02 00 00 call 312 <unlink> 3a: 83 c4 10 add $0x10,%esp 3d: 85 c0 test %eax,%eax 3f: 78 0f js 50 <main+0x50> if(argc < 2){ printf(2, "Usage: rm files...\n"); exit(); } for(i = 1; i < argc; i++){ 41: 83 c7 01 add $0x1,%edi 44: 83 c3 04 add $0x4,%ebx 47: 39 fe cmp %edi,%esi 49: 75 e5 jne 30 <main+0x30> printf(2, "rm: %s failed to delete\n", argv[i]); break; } } exit(); 4b: e8 72 02 00 00 call 2c2 <exit> exit(); } for(i = 1; i < argc; i++){ if(unlink(argv[i]) < 0){ printf(2, "rm: %s failed to delete\n", argv[i]); 50: 50 push %eax 51: ff 33 pushl (%ebx) 53: 68 44 07 00 00 push $0x744 58: 6a 02 push $0x2 5a: e8 b1 03 00 00 call 410 <printf> break; 5f: 83 c4 10 add $0x10,%esp 62: eb e7 jmp 4b <main+0x4b> main(int argc, char *argv[]) { int i; if(argc < 2){ printf(2, "Usage: rm files...\n"); 64: 52 push %edx 65: 52 push %edx 66: 68 30 07 00 00 push $0x730 6b: 6a 02 push $0x2 6d: e8 9e 03 00 00 call 410 <printf> exit(); 72: e8 4b 02 00 00 call 2c2 <exit> 77: 66 90 xchg %ax,%ax 79: 66 90 xchg %ax,%ax 7b: 66 90 xchg %ax,%ax 7d: 66 90 xchg %ax,%ax 7f: 90 nop 00000080 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 80: 55 push %ebp 81: 89 e5 mov %esp,%ebp 83: 53 push %ebx 84: 8b 45 08 mov 0x8(%ebp),%eax 87: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 8a: 89 c2 mov %eax,%edx 8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 90: 83 c1 01 add $0x1,%ecx 93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 97: 83 c2 01 add $0x1,%edx 9a: 84 db test %bl,%bl 9c: 88 5a ff mov %bl,-0x1(%edx) 9f: 75 ef jne 90 <strcpy+0x10> ; return os; } a1: 5b pop %ebx a2: 5d pop %ebp a3: c3 ret a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000000b0 <strcmp>: int strcmp(const char *p, const char *q) { b0: 55 push %ebp b1: 89 e5 mov %esp,%ebp b3: 56 push %esi b4: 53 push %ebx b5: 8b 55 08 mov 0x8(%ebp),%edx b8: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) bb: 0f b6 02 movzbl (%edx),%eax be: 0f b6 19 movzbl (%ecx),%ebx c1: 84 c0 test %al,%al c3: 75 1e jne e3 <strcmp+0x33> c5: eb 29 jmp f0 <strcmp+0x40> c7: 89 f6 mov %esi,%esi c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; d0: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d3: 0f b6 02 movzbl (%edx),%eax p++, q++; d6: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx dd: 84 c0 test %al,%al df: 74 0f je f0 <strcmp+0x40> e1: 89 f1 mov %esi,%ecx e3: 38 d8 cmp %bl,%al e5: 74 e9 je d0 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; e7: 29 d8 sub %ebx,%eax } e9: 5b pop %ebx ea: 5e pop %esi eb: 5d pop %ebp ec: c3 ret ed: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) f0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; f2: 29 d8 sub %ebx,%eax } f4: 5b pop %ebx f5: 5e pop %esi f6: 5d pop %ebp f7: c3 ret f8: 90 nop f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000100 <strlen>: uint strlen(const char *s) { 100: 55 push %ebp 101: 89 e5 mov %esp,%ebp 103: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 106: 80 39 00 cmpb $0x0,(%ecx) 109: 74 12 je 11d <strlen+0x1d> 10b: 31 d2 xor %edx,%edx 10d: 8d 76 00 lea 0x0(%esi),%esi 110: 83 c2 01 add $0x1,%edx 113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 117: 89 d0 mov %edx,%eax 119: 75 f5 jne 110 <strlen+0x10> ; return n; } 11b: 5d pop %ebp 11c: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 11d: 31 c0 xor %eax,%eax ; return n; } 11f: 5d pop %ebp 120: c3 ret 121: eb 0d jmp 130 <memset> 123: 90 nop 124: 90 nop 125: 90 nop 126: 90 nop 127: 90 nop 128: 90 nop 129: 90 nop 12a: 90 nop 12b: 90 nop 12c: 90 nop 12d: 90 nop 12e: 90 nop 12f: 90 nop 00000130 <memset>: void* memset(void *dst, int c, uint n) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 57 push %edi 134: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 137: 8b 4d 10 mov 0x10(%ebp),%ecx 13a: 8b 45 0c mov 0xc(%ebp),%eax 13d: 89 d7 mov %edx,%edi 13f: fc cld 140: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 142: 89 d0 mov %edx,%eax 144: 5f pop %edi 145: 5d pop %ebp 146: c3 ret 147: 89 f6 mov %esi,%esi 149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000150 <strchr>: char* strchr(const char *s, char c) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 53 push %ebx 154: 8b 45 08 mov 0x8(%ebp),%eax 157: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 15a: 0f b6 10 movzbl (%eax),%edx 15d: 84 d2 test %dl,%dl 15f: 74 1d je 17e <strchr+0x2e> if(*s == c) 161: 38 d3 cmp %dl,%bl 163: 89 d9 mov %ebx,%ecx 165: 75 0d jne 174 <strchr+0x24> 167: eb 17 jmp 180 <strchr+0x30> 169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 170: 38 ca cmp %cl,%dl 172: 74 0c je 180 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 174: 83 c0 01 add $0x1,%eax 177: 0f b6 10 movzbl (%eax),%edx 17a: 84 d2 test %dl,%dl 17c: 75 f2 jne 170 <strchr+0x20> if(*s == c) return (char*)s; return 0; 17e: 31 c0 xor %eax,%eax } 180: 5b pop %ebx 181: 5d pop %ebp 182: c3 ret 183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000190 <gets>: char* gets(char *buf, int max) { 190: 55 push %ebp 191: 89 e5 mov %esp,%ebp 193: 57 push %edi 194: 56 push %esi 195: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 196: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 198: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 19b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 19e: eb 29 jmp 1c9 <gets+0x39> cc = read(0, &c, 1); 1a0: 83 ec 04 sub $0x4,%esp 1a3: 6a 01 push $0x1 1a5: 57 push %edi 1a6: 6a 00 push $0x0 1a8: e8 2d 01 00 00 call 2da <read> if(cc < 1) 1ad: 83 c4 10 add $0x10,%esp 1b0: 85 c0 test %eax,%eax 1b2: 7e 1d jle 1d1 <gets+0x41> break; buf[i++] = c; 1b4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 1b8: 8b 55 08 mov 0x8(%ebp),%edx 1bb: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 1bd: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 1bf: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 1c3: 74 1b je 1e0 <gets+0x50> 1c5: 3c 0d cmp $0xd,%al 1c7: 74 17 je 1e0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1c9: 8d 5e 01 lea 0x1(%esi),%ebx 1cc: 3b 5d 0c cmp 0xc(%ebp),%ebx 1cf: 7c cf jl 1a0 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1d1: 8b 45 08 mov 0x8(%ebp),%eax 1d4: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1d8: 8d 65 f4 lea -0xc(%ebp),%esp 1db: 5b pop %ebx 1dc: 5e pop %esi 1dd: 5f pop %edi 1de: 5d pop %ebp 1df: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1e0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1e3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1e5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 1e9: 8d 65 f4 lea -0xc(%ebp),%esp 1ec: 5b pop %ebx 1ed: 5e pop %esi 1ee: 5f pop %edi 1ef: 5d pop %ebp 1f0: c3 ret 1f1: eb 0d jmp 200 <stat> 1f3: 90 nop 1f4: 90 nop 1f5: 90 nop 1f6: 90 nop 1f7: 90 nop 1f8: 90 nop 1f9: 90 nop 1fa: 90 nop 1fb: 90 nop 1fc: 90 nop 1fd: 90 nop 1fe: 90 nop 1ff: 90 nop 00000200 <stat>: int stat(const char *n, struct stat *st) { 200: 55 push %ebp 201: 89 e5 mov %esp,%ebp 203: 56 push %esi 204: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 205: 83 ec 08 sub $0x8,%esp 208: 6a 00 push $0x0 20a: ff 75 08 pushl 0x8(%ebp) 20d: e8 f0 00 00 00 call 302 <open> if(fd < 0) 212: 83 c4 10 add $0x10,%esp 215: 85 c0 test %eax,%eax 217: 78 27 js 240 <stat+0x40> return -1; r = fstat(fd, st); 219: 83 ec 08 sub $0x8,%esp 21c: ff 75 0c pushl 0xc(%ebp) 21f: 89 c3 mov %eax,%ebx 221: 50 push %eax 222: e8 f3 00 00 00 call 31a <fstat> 227: 89 c6 mov %eax,%esi close(fd); 229: 89 1c 24 mov %ebx,(%esp) 22c: e8 b9 00 00 00 call 2ea <close> return r; 231: 83 c4 10 add $0x10,%esp 234: 89 f0 mov %esi,%eax } 236: 8d 65 f8 lea -0x8(%ebp),%esp 239: 5b pop %ebx 23a: 5e pop %esi 23b: 5d pop %ebp 23c: c3 ret 23d: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 240: b8 ff ff ff ff mov $0xffffffff,%eax 245: eb ef jmp 236 <stat+0x36> 247: 89 f6 mov %esi,%esi 249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000250 <atoi>: return r; } int atoi(const char *s) { 250: 55 push %ebp 251: 89 e5 mov %esp,%ebp 253: 53 push %ebx 254: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 257: 0f be 11 movsbl (%ecx),%edx 25a: 8d 42 d0 lea -0x30(%edx),%eax 25d: 3c 09 cmp $0x9,%al 25f: b8 00 00 00 00 mov $0x0,%eax 264: 77 1f ja 285 <atoi+0x35> 266: 8d 76 00 lea 0x0(%esi),%esi 269: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 270: 8d 04 80 lea (%eax,%eax,4),%eax 273: 83 c1 01 add $0x1,%ecx 276: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 27a: 0f be 11 movsbl (%ecx),%edx 27d: 8d 5a d0 lea -0x30(%edx),%ebx 280: 80 fb 09 cmp $0x9,%bl 283: 76 eb jbe 270 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 285: 5b pop %ebx 286: 5d pop %ebp 287: c3 ret 288: 90 nop 289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000290 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 290: 55 push %ebp 291: 89 e5 mov %esp,%ebp 293: 56 push %esi 294: 53 push %ebx 295: 8b 5d 10 mov 0x10(%ebp),%ebx 298: 8b 45 08 mov 0x8(%ebp),%eax 29b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 29e: 85 db test %ebx,%ebx 2a0: 7e 14 jle 2b6 <memmove+0x26> 2a2: 31 d2 xor %edx,%edx 2a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 2a8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 2ac: 88 0c 10 mov %cl,(%eax,%edx,1) 2af: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 2b2: 39 da cmp %ebx,%edx 2b4: 75 f2 jne 2a8 <memmove+0x18> *dst++ = *src++; return vdst; } 2b6: 5b pop %ebx 2b7: 5e pop %esi 2b8: 5d pop %ebp 2b9: c3 ret 000002ba <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2ba: b8 01 00 00 00 mov $0x1,%eax 2bf: cd 40 int $0x40 2c1: c3 ret 000002c2 <exit>: SYSCALL(exit) 2c2: b8 02 00 00 00 mov $0x2,%eax 2c7: cd 40 int $0x40 2c9: c3 ret 000002ca <wait>: SYSCALL(wait) 2ca: b8 03 00 00 00 mov $0x3,%eax 2cf: cd 40 int $0x40 2d1: c3 ret 000002d2 <pipe>: SYSCALL(pipe) 2d2: b8 04 00 00 00 mov $0x4,%eax 2d7: cd 40 int $0x40 2d9: c3 ret 000002da <read>: SYSCALL(read) 2da: b8 05 00 00 00 mov $0x5,%eax 2df: cd 40 int $0x40 2e1: c3 ret 000002e2 <write>: SYSCALL(write) 2e2: b8 10 00 00 00 mov $0x10,%eax 2e7: cd 40 int $0x40 2e9: c3 ret 000002ea <close>: SYSCALL(close) 2ea: b8 15 00 00 00 mov $0x15,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <kill>: SYSCALL(kill) 2f2: b8 06 00 00 00 mov $0x6,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <exec>: SYSCALL(exec) 2fa: b8 07 00 00 00 mov $0x7,%eax 2ff: cd 40 int $0x40 301: c3 ret 00000302 <open>: SYSCALL(open) 302: b8 0f 00 00 00 mov $0xf,%eax 307: cd 40 int $0x40 309: c3 ret 0000030a <mknod>: SYSCALL(mknod) 30a: b8 11 00 00 00 mov $0x11,%eax 30f: cd 40 int $0x40 311: c3 ret 00000312 <unlink>: SYSCALL(unlink) 312: b8 12 00 00 00 mov $0x12,%eax 317: cd 40 int $0x40 319: c3 ret 0000031a <fstat>: SYSCALL(fstat) 31a: b8 08 00 00 00 mov $0x8,%eax 31f: cd 40 int $0x40 321: c3 ret 00000322 <link>: SYSCALL(link) 322: b8 13 00 00 00 mov $0x13,%eax 327: cd 40 int $0x40 329: c3 ret 0000032a <mkdir>: SYSCALL(mkdir) 32a: b8 14 00 00 00 mov $0x14,%eax 32f: cd 40 int $0x40 331: c3 ret 00000332 <chdir>: SYSCALL(chdir) 332: b8 09 00 00 00 mov $0x9,%eax 337: cd 40 int $0x40 339: c3 ret 0000033a <dup>: SYSCALL(dup) 33a: b8 0a 00 00 00 mov $0xa,%eax 33f: cd 40 int $0x40 341: c3 ret 00000342 <getpid>: SYSCALL(getpid) 342: b8 0b 00 00 00 mov $0xb,%eax 347: cd 40 int $0x40 349: c3 ret 0000034a <sbrk>: SYSCALL(sbrk) 34a: b8 0c 00 00 00 mov $0xc,%eax 34f: cd 40 int $0x40 351: c3 ret 00000352 <sleep>: SYSCALL(sleep) 352: b8 0d 00 00 00 mov $0xd,%eax 357: cd 40 int $0x40 359: c3 ret 0000035a <uptime>: SYSCALL(uptime) 35a: b8 0e 00 00 00 mov $0xe,%eax 35f: cd 40 int $0x40 361: c3 ret 00000362 <cps>: SYSCALL(cps) 362: b8 16 00 00 00 mov $0x16,%eax 367: cd 40 int $0x40 369: c3 ret 36a: 66 90 xchg %ax,%ax 36c: 66 90 xchg %ax,%ax 36e: 66 90 xchg %ax,%ax 00000370 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 57 push %edi 374: 56 push %esi 375: 53 push %ebx 376: 89 c6 mov %eax,%esi 378: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 37b: 8b 5d 08 mov 0x8(%ebp),%ebx 37e: 85 db test %ebx,%ebx 380: 74 7e je 400 <printint+0x90> 382: 89 d0 mov %edx,%eax 384: c1 e8 1f shr $0x1f,%eax 387: 84 c0 test %al,%al 389: 74 75 je 400 <printint+0x90> neg = 1; x = -xx; 38b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 38d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 394: f7 d8 neg %eax 396: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 399: 31 ff xor %edi,%edi 39b: 8d 5d d7 lea -0x29(%ebp),%ebx 39e: 89 ce mov %ecx,%esi 3a0: eb 08 jmp 3aa <printint+0x3a> 3a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 3a8: 89 cf mov %ecx,%edi 3aa: 31 d2 xor %edx,%edx 3ac: 8d 4f 01 lea 0x1(%edi),%ecx 3af: f7 f6 div %esi 3b1: 0f b6 92 64 07 00 00 movzbl 0x764(%edx),%edx }while((x /= base) != 0); 3b8: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 3ba: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 3bd: 75 e9 jne 3a8 <printint+0x38> if(neg) 3bf: 8b 45 c4 mov -0x3c(%ebp),%eax 3c2: 8b 75 c0 mov -0x40(%ebp),%esi 3c5: 85 c0 test %eax,%eax 3c7: 74 08 je 3d1 <printint+0x61> buf[i++] = '-'; 3c9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 3ce: 8d 4f 02 lea 0x2(%edi),%ecx 3d1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 3d5: 8d 76 00 lea 0x0(%esi),%esi 3d8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 3db: 83 ec 04 sub $0x4,%esp 3de: 83 ef 01 sub $0x1,%edi 3e1: 6a 01 push $0x1 3e3: 53 push %ebx 3e4: 56 push %esi 3e5: 88 45 d7 mov %al,-0x29(%ebp) 3e8: e8 f5 fe ff ff call 2e2 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 3ed: 83 c4 10 add $0x10,%esp 3f0: 39 df cmp %ebx,%edi 3f2: 75 e4 jne 3d8 <printint+0x68> putc(fd, buf[i]); } 3f4: 8d 65 f4 lea -0xc(%ebp),%esp 3f7: 5b pop %ebx 3f8: 5e pop %esi 3f9: 5f pop %edi 3fa: 5d pop %ebp 3fb: c3 ret 3fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 400: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 402: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 409: eb 8b jmp 396 <printint+0x26> 40b: 90 nop 40c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000410 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 410: 55 push %ebp 411: 89 e5 mov %esp,%ebp 413: 57 push %edi 414: 56 push %esi 415: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 416: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 419: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 41c: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 41f: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 422: 89 45 d0 mov %eax,-0x30(%ebp) 425: 0f b6 1e movzbl (%esi),%ebx 428: 83 c6 01 add $0x1,%esi 42b: 84 db test %bl,%bl 42d: 0f 84 b0 00 00 00 je 4e3 <printf+0xd3> 433: 31 d2 xor %edx,%edx 435: eb 39 jmp 470 <printf+0x60> 437: 89 f6 mov %esi,%esi 439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 440: 83 f8 25 cmp $0x25,%eax 443: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 446: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 44b: 74 18 je 465 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 44d: 8d 45 e2 lea -0x1e(%ebp),%eax 450: 83 ec 04 sub $0x4,%esp 453: 88 5d e2 mov %bl,-0x1e(%ebp) 456: 6a 01 push $0x1 458: 50 push %eax 459: 57 push %edi 45a: e8 83 fe ff ff call 2e2 <write> 45f: 8b 55 d4 mov -0x2c(%ebp),%edx 462: 83 c4 10 add $0x10,%esp 465: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 468: 0f b6 5e ff movzbl -0x1(%esi),%ebx 46c: 84 db test %bl,%bl 46e: 74 73 je 4e3 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 470: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 472: 0f be cb movsbl %bl,%ecx 475: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 478: 74 c6 je 440 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 47a: 83 fa 25 cmp $0x25,%edx 47d: 75 e6 jne 465 <printf+0x55> if(c == 'd'){ 47f: 83 f8 64 cmp $0x64,%eax 482: 0f 84 f8 00 00 00 je 580 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 488: 81 e1 f7 00 00 00 and $0xf7,%ecx 48e: 83 f9 70 cmp $0x70,%ecx 491: 74 5d je 4f0 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 493: 83 f8 73 cmp $0x73,%eax 496: 0f 84 84 00 00 00 je 520 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 49c: 83 f8 63 cmp $0x63,%eax 49f: 0f 84 ea 00 00 00 je 58f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 4a5: 83 f8 25 cmp $0x25,%eax 4a8: 0f 84 c2 00 00 00 je 570 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4ae: 8d 45 e7 lea -0x19(%ebp),%eax 4b1: 83 ec 04 sub $0x4,%esp 4b4: c6 45 e7 25 movb $0x25,-0x19(%ebp) 4b8: 6a 01 push $0x1 4ba: 50 push %eax 4bb: 57 push %edi 4bc: e8 21 fe ff ff call 2e2 <write> 4c1: 83 c4 0c add $0xc,%esp 4c4: 8d 45 e6 lea -0x1a(%ebp),%eax 4c7: 88 5d e6 mov %bl,-0x1a(%ebp) 4ca: 6a 01 push $0x1 4cc: 50 push %eax 4cd: 57 push %edi 4ce: 83 c6 01 add $0x1,%esi 4d1: e8 0c fe ff ff call 2e2 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4d6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4da: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4dd: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 4df: 84 db test %bl,%bl 4e1: 75 8d jne 470 <printf+0x60> putc(fd, c); } state = 0; } } } 4e3: 8d 65 f4 lea -0xc(%ebp),%esp 4e6: 5b pop %ebx 4e7: 5e pop %esi 4e8: 5f pop %edi 4e9: 5d pop %ebp 4ea: c3 ret 4eb: 90 nop 4ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 4f0: 83 ec 0c sub $0xc,%esp 4f3: b9 10 00 00 00 mov $0x10,%ecx 4f8: 6a 00 push $0x0 4fa: 8b 5d d0 mov -0x30(%ebp),%ebx 4fd: 89 f8 mov %edi,%eax 4ff: 8b 13 mov (%ebx),%edx 501: e8 6a fe ff ff call 370 <printint> ap++; 506: 89 d8 mov %ebx,%eax 508: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 50b: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 50d: 83 c0 04 add $0x4,%eax 510: 89 45 d0 mov %eax,-0x30(%ebp) 513: e9 4d ff ff ff jmp 465 <printf+0x55> 518: 90 nop 519: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 520: 8b 45 d0 mov -0x30(%ebp),%eax 523: 8b 18 mov (%eax),%ebx ap++; 525: 83 c0 04 add $0x4,%eax 528: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 52b: b8 5d 07 00 00 mov $0x75d,%eax 530: 85 db test %ebx,%ebx 532: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 535: 0f b6 03 movzbl (%ebx),%eax 538: 84 c0 test %al,%al 53a: 74 23 je 55f <printf+0x14f> 53c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 540: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 543: 8d 45 e3 lea -0x1d(%ebp),%eax 546: 83 ec 04 sub $0x4,%esp 549: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 54b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 54e: 50 push %eax 54f: 57 push %edi 550: e8 8d fd ff ff call 2e2 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 555: 0f b6 03 movzbl (%ebx),%eax 558: 83 c4 10 add $0x10,%esp 55b: 84 c0 test %al,%al 55d: 75 e1 jne 540 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 55f: 31 d2 xor %edx,%edx 561: e9 ff fe ff ff jmp 465 <printf+0x55> 566: 8d 76 00 lea 0x0(%esi),%esi 569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 570: 83 ec 04 sub $0x4,%esp 573: 88 5d e5 mov %bl,-0x1b(%ebp) 576: 8d 45 e5 lea -0x1b(%ebp),%eax 579: 6a 01 push $0x1 57b: e9 4c ff ff ff jmp 4cc <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 580: 83 ec 0c sub $0xc,%esp 583: b9 0a 00 00 00 mov $0xa,%ecx 588: 6a 01 push $0x1 58a: e9 6b ff ff ff jmp 4fa <printf+0xea> 58f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 592: 83 ec 04 sub $0x4,%esp 595: 8b 03 mov (%ebx),%eax 597: 6a 01 push $0x1 599: 88 45 e4 mov %al,-0x1c(%ebp) 59c: 8d 45 e4 lea -0x1c(%ebp),%eax 59f: 50 push %eax 5a0: 57 push %edi 5a1: e8 3c fd ff ff call 2e2 <write> 5a6: e9 5b ff ff ff jmp 506 <printf+0xf6> 5ab: 66 90 xchg %ax,%ax 5ad: 66 90 xchg %ax,%ax 5af: 90 nop 000005b0 <free>: static Header base; static Header *freep; void free(void *ap) { 5b0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5b1: a1 08 0a 00 00 mov 0xa08,%eax static Header base; static Header *freep; void free(void *ap) { 5b6: 89 e5 mov %esp,%ebp 5b8: 57 push %edi 5b9: 56 push %esi 5ba: 53 push %ebx 5bb: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5be: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 5c0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5c3: 39 c8 cmp %ecx,%eax 5c5: 73 19 jae 5e0 <free+0x30> 5c7: 89 f6 mov %esi,%esi 5c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 5d0: 39 d1 cmp %edx,%ecx 5d2: 72 1c jb 5f0 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5d4: 39 d0 cmp %edx,%eax 5d6: 73 18 jae 5f0 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 5d8: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5da: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5dc: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5de: 72 f0 jb 5d0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5e0: 39 d0 cmp %edx,%eax 5e2: 72 f4 jb 5d8 <free+0x28> 5e4: 39 d1 cmp %edx,%ecx 5e6: 73 f0 jae 5d8 <free+0x28> 5e8: 90 nop 5e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 5f0: 8b 73 fc mov -0x4(%ebx),%esi 5f3: 8d 3c f1 lea (%ecx,%esi,8),%edi 5f6: 39 d7 cmp %edx,%edi 5f8: 74 19 je 613 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 5fa: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 5fd: 8b 50 04 mov 0x4(%eax),%edx 600: 8d 34 d0 lea (%eax,%edx,8),%esi 603: 39 f1 cmp %esi,%ecx 605: 74 23 je 62a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 607: 89 08 mov %ecx,(%eax) freep = p; 609: a3 08 0a 00 00 mov %eax,0xa08 } 60e: 5b pop %ebx 60f: 5e pop %esi 610: 5f pop %edi 611: 5d pop %ebp 612: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 613: 03 72 04 add 0x4(%edx),%esi 616: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 619: 8b 10 mov (%eax),%edx 61b: 8b 12 mov (%edx),%edx 61d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 620: 8b 50 04 mov 0x4(%eax),%edx 623: 8d 34 d0 lea (%eax,%edx,8),%esi 626: 39 f1 cmp %esi,%ecx 628: 75 dd jne 607 <free+0x57> p->s.size += bp->s.size; 62a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 62d: a3 08 0a 00 00 mov %eax,0xa08 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 632: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 635: 8b 53 f8 mov -0x8(%ebx),%edx 638: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 63a: 5b pop %ebx 63b: 5e pop %esi 63c: 5f pop %edi 63d: 5d pop %ebp 63e: c3 ret 63f: 90 nop 00000640 <malloc>: return freep; } void* malloc(uint nbytes) { 640: 55 push %ebp 641: 89 e5 mov %esp,%ebp 643: 57 push %edi 644: 56 push %esi 645: 53 push %ebx 646: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 649: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 64c: 8b 15 08 0a 00 00 mov 0xa08,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 652: 8d 78 07 lea 0x7(%eax),%edi 655: c1 ef 03 shr $0x3,%edi 658: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 65b: 85 d2 test %edx,%edx 65d: 0f 84 a3 00 00 00 je 706 <malloc+0xc6> 663: 8b 02 mov (%edx),%eax 665: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 668: 39 cf cmp %ecx,%edi 66a: 76 74 jbe 6e0 <malloc+0xa0> 66c: 81 ff 00 10 00 00 cmp $0x1000,%edi 672: be 00 10 00 00 mov $0x1000,%esi 677: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 67e: 0f 43 f7 cmovae %edi,%esi 681: ba 00 80 00 00 mov $0x8000,%edx 686: 81 ff ff 0f 00 00 cmp $0xfff,%edi 68c: 0f 46 da cmovbe %edx,%ebx 68f: eb 10 jmp 6a1 <malloc+0x61> 691: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 698: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 69a: 8b 48 04 mov 0x4(%eax),%ecx 69d: 39 cf cmp %ecx,%edi 69f: 76 3f jbe 6e0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 6a1: 39 05 08 0a 00 00 cmp %eax,0xa08 6a7: 89 c2 mov %eax,%edx 6a9: 75 ed jne 698 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 6ab: 83 ec 0c sub $0xc,%esp 6ae: 53 push %ebx 6af: e8 96 fc ff ff call 34a <sbrk> if(p == (char*)-1) 6b4: 83 c4 10 add $0x10,%esp 6b7: 83 f8 ff cmp $0xffffffff,%eax 6ba: 74 1c je 6d8 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 6bc: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 6bf: 83 ec 0c sub $0xc,%esp 6c2: 83 c0 08 add $0x8,%eax 6c5: 50 push %eax 6c6: e8 e5 fe ff ff call 5b0 <free> return freep; 6cb: 8b 15 08 0a 00 00 mov 0xa08,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 6d1: 83 c4 10 add $0x10,%esp 6d4: 85 d2 test %edx,%edx 6d6: 75 c0 jne 698 <malloc+0x58> return 0; 6d8: 31 c0 xor %eax,%eax 6da: eb 1c jmp 6f8 <malloc+0xb8> 6dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 6e0: 39 cf cmp %ecx,%edi 6e2: 74 1c je 700 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 6e4: 29 f9 sub %edi,%ecx 6e6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 6e9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 6ec: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 6ef: 89 15 08 0a 00 00 mov %edx,0xa08 return (void*)(p + 1); 6f5: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 6f8: 8d 65 f4 lea -0xc(%ebp),%esp 6fb: 5b pop %ebx 6fc: 5e pop %esi 6fd: 5f pop %edi 6fe: 5d pop %ebp 6ff: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 700: 8b 08 mov (%eax),%ecx 702: 89 0a mov %ecx,(%edx) 704: eb e9 jmp 6ef <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 706: c7 05 08 0a 00 00 0c movl $0xa0c,0xa08 70d: 0a 00 00 710: c7 05 0c 0a 00 00 0c movl $0xa0c,0xa0c 717: 0a 00 00 base.s.size = 0; 71a: b8 0c 0a 00 00 mov $0xa0c,%eax 71f: c7 05 10 0a 00 00 00 movl $0x0,0xa10 726: 00 00 00 729: e9 3e ff ff ff jmp 66c <malloc+0x2c>
// This is a comment. // This is another comment. // And another.
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x17093, %r14 nop nop nop mfence movl $0x61626364, (%r14) nop nop xor %r13, %r13 lea addresses_UC_ht+0x16bad, %rbp and $14289, %rdi movl $0x61626364, (%rbp) nop nop nop and $1304, %rbp lea addresses_UC_ht+0x1b1fa, %r11 nop add %r13, %r13 movb (%r11), %r14b nop nop sub $51305, %rdi lea addresses_D_ht+0xc9d, %rsi lea addresses_A_ht+0x19e2d, %rdi nop nop nop xor $54849, %r14 mov $89, %rcx rep movsq nop inc %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r9 push %rbx push %rcx // Faulty Load lea addresses_PSE+0xa3ad, %r9 nop nop nop nop and $64499, %rbx mov (%r9), %cx lea oracles, %r15 and $0xff, %rcx shlq $12, %rcx mov (%r15,%rcx,1), %rcx pop %rcx pop %rbx pop %r9 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': True}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x18945, %rax nop nop nop nop nop add %rdx, %rdx mov $0x6162636465666768, %r14 movq %r14, %xmm4 and $0xffffffffffffffc0, %rax movntdq %xmm4, (%rax) nop nop nop nop nop cmp $18599, %rcx lea addresses_A_ht+0x6cfe, %rdi nop nop cmp %r10, %r10 vmovups (%rdi), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %rdx nop xor %rcx, %rcx lea addresses_normal_ht+0x11145, %rsi lea addresses_WC_ht+0xbf45, %rdi add $49027, %rax mov $13, %rcx rep movsl nop cmp %rax, %rax lea addresses_WT_ht+0x1e1c5, %r10 nop nop add $417, %r14 vmovups (%r10), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $0, %xmm2, %rcx nop nop nop nop xor %rax, %rax lea addresses_WC_ht+0x33d4, %r10 nop nop inc %rcx movb $0x61, (%r10) add %rsi, %rsi lea addresses_A_ht+0xa3e5, %r14 cmp %rax, %rax mov (%r14), %rdx nop nop nop nop xor $27702, %r14 lea addresses_WC_ht+0x18385, %rsi lea addresses_UC_ht+0x1432d, %rdi nop nop and $17715, %rdx mov $118, %rcx rep movsq nop nop sub %rdx, %rdx lea addresses_WC_ht+0x15c99, %r10 nop nop nop nop add $64756, %rdi and $0xffffffffffffffc0, %r10 vmovaps (%r10), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %rcx nop nop nop nop mfence lea addresses_WT_ht+0x1945, %r14 nop sub $45492, %rdx movw $0x6162, (%r14) nop nop nop nop xor $18381, %r10 lea addresses_A_ht+0xdb45, %rdi nop nop nop xor %rsi, %rsi mov $0x6162636465666768, %r10 movq %r10, (%rdi) nop nop sub %rax, %rax lea addresses_UC_ht+0x1bfd1, %r10 dec %rdx movb (%r10), %r14b nop nop cmp $887, %r10 lea addresses_WT_ht+0xf4c5, %rsi lea addresses_D_ht+0x1c545, %rdi nop nop nop nop nop inc %r9 mov $71, %rcx rep movsq nop nop and $21189, %r9 lea addresses_D_ht+0x15345, %r14 nop nop nop nop inc %r9 movl $0x61626364, (%r14) nop nop nop nop cmp %r9, %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %r15 push %r8 push %rbx push %rdx // Store mov $0x2225710000000985, %rdx nop nop nop nop nop xor $63249, %r11 movb $0x51, (%rdx) sub %r15, %r15 // Store lea addresses_RW+0x611, %r11 nop nop nop nop nop sub %r10, %r10 movb $0x51, (%r11) nop nop and $20924, %rdx // Faulty Load mov $0x682fb00000000145, %r14 nop nop sub %r15, %r15 movb (%r14), %dl lea oracles, %r8 and $0xff, %rdx shlq $12, %rdx mov (%r8,%rdx,1), %rdx pop %rdx pop %rbx pop %r8 pop %r15 pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_NC'}} {'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_RW'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_A_ht'}} {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 1, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
frame 0, 12 setrepeat 3 frame 1, 09 frame 2, 07 dorepeat 2 endanim
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* swapPairs(ListNode* head) { if(head==NULL or head->next==NULL) return head; ListNode* newhead=head->next; ListNode* remaining=head->next->next; head->next->next=head; head->next=swapPairs(remaining); return newhead; } };
; $Id: VMMRCA.asm 69221 2017-10-24 15:07:46Z vboxsync $ ;; @file ; VMMRC - Raw-mode Context Virtual Machine Monitor assembly routines. ; ; ; Copyright (C) 2006-2017 Oracle Corporation ; ; This file is part of VirtualBox Open Source Edition (OSE), as ; available from http://www.virtualbox.org. This file is free software; ; you can redistribute it and/or modify it under the terms of the GNU ; General Public License (GPL) as published by the Free Software ; Foundation, in version 2 as it comes in the "COPYING" file of the ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. ; ;******************************************************************************* ;* Header Files * ;******************************************************************************* %include "VBox/asmdefs.mac" %include "iprt/x86.mac" %include "VBox/sup.mac" %include "VBox/vmm/vm.mac" %include "VMMInternal.mac" %include "VMMRC.mac" ;******************************************************************************* ;* Defined Constants And Macros * ;******************************************************************************* ;; save all registers before loading special values for the faulting. %macro SaveAndLoadAll 0 pushad push ds push es push fs push gs call NAME(vmmGCTestLoadRegs) %endmacro ;; restore all registers after faulting. %macro RestoreAll 0 pop gs pop fs pop es pop ds popad %endmacro ;******************************************************************************* ;* External Symbols * ;******************************************************************************* extern IMPNAME(g_VM) extern IMPNAME(g_Logger) extern IMPNAME(g_RelLogger) extern NAME(RTLogLogger) extern NAME(vmmRCProbeFireHelper) extern NAME(TRPMRCTrapHyperHandlerSetEIP) BEGINCODE ;/** ; * Internal GC logger worker: Logger wrapper. ; */ ;VMMRCDECL(void) vmmGCLoggerWrapper(const char *pszFormat, ...); EXPORTEDNAME vmmGCLoggerWrapper %ifdef __YASM__ %ifdef ASM_FORMAT_ELF push dword IMP(g_Logger) ; YASM BUG #67! YASMCHECK! %else push IMP(g_Logger) %endif %else push IMP(g_Logger) %endif call NAME(RTLogLogger) add esp, byte 4 ret ENDPROC vmmGCLoggerWrapper ;/** ; * Internal GC logger worker: Logger (release) wrapper. ; */ ;VMMRCDECL(void) vmmGCRelLoggerWrapper(const char *pszFormat, ...); EXPORTEDNAME vmmGCRelLoggerWrapper %ifdef __YASM__ %ifdef ASM_FORMAT_ELF push dword IMP(g_RelLogger) ; YASM BUG #67! YASMCHECK! %else push IMP(g_RelLogger) %endif %else push IMP(g_RelLogger) %endif call NAME(RTLogLogger) add esp, byte 4 ret ENDPROC vmmGCRelLoggerWrapper ;; ; Enables write protection. BEGINPROC vmmGCEnableWP push eax mov eax, cr0 or eax, X86_CR0_WRITE_PROTECT mov cr0, eax pop eax ret ENDPROC vmmGCEnableWP ;; ; Disables write protection. BEGINPROC vmmGCDisableWP push eax mov eax, cr0 and eax, ~X86_CR0_WRITE_PROTECT mov cr0, eax pop eax ret ENDPROC vmmGCDisableWP ;; ; Load special register set expected upon faults. ; All registers are changed. BEGINPROC vmmGCTestLoadRegs mov eax, ss mov ds, eax mov es, eax mov fs, eax mov gs, eax mov edi, 001234567h mov esi, 042000042h mov ebp, 0ffeeddcch mov ebx, 089abcdefh mov ecx, 0ffffaaaah mov edx, 077778888h mov eax, 0f0f0f0f0h ret ENDPROC vmmGCTestLoadRegs ;; ; A Trap 3 testcase. GLOBALNAME vmmGCTestTrap3 SaveAndLoadAll int 3 EXPORTEDNAME vmmGCTestTrap3_FaultEIP RestoreAll mov eax, 0ffffffffh ret ENDPROC vmmGCTestTrap3 ;; ; A Trap 8 testcase. GLOBALNAME vmmGCTestTrap8 SaveAndLoadAll sub esp, byte 8 sidt [esp] mov word [esp], 111 ; make any #PF double fault. lidt [esp] add esp, byte 8 COM_S_CHAR '!' xor eax, eax EXPORTEDNAME vmmGCTestTrap8_FaultEIP mov eax, [eax] COM_S_CHAR '2' RestoreAll mov eax, 0ffffffffh ret ENDPROC vmmGCTestTrap8 ;; ; A simple Trap 0d testcase. GLOBALNAME vmmGCTestTrap0d SaveAndLoadAll push ds EXPORTEDNAME vmmGCTestTrap0d_FaultEIP ltr [esp] pop eax RestoreAll mov eax, 0ffffffffh ret ENDPROC vmmGCTestTrap0d ;; ; A simple Trap 0e testcase. GLOBALNAME vmmGCTestTrap0e SaveAndLoadAll xor eax, eax EXPORTEDNAME vmmGCTestTrap0e_FaultEIP mov eax, [eax] RestoreAll mov eax, 0ffffffffh ret EXPORTEDNAME vmmGCTestTrap0e_ResumeEIP RestoreAll xor eax, eax ret ENDPROC vmmGCTestTrap0e ;; ; Safely reads an MSR. ; @returns boolean ; @param uMsr The MSR to red. ; @param pu64Value Where to return the value on success. ; GLOBALNAME vmmRCSafeMsrRead push ebp mov ebp, esp pushf cli push esi push edi push ebx push ebp mov ecx, [ebp + 8] ; The MSR to read. mov eax, 0deadbeefh mov edx, 0deadbeefh TRPM_GP_HANDLER NAME(TRPMRCTrapHyperHandlerSetEIP), .trapped rdmsr mov ecx, [ebp + 0ch] ; Where to store the result. mov [ecx], eax mov [ecx + 4], edx mov eax, 1 .return: pop ebp pop ebx pop edi pop esi popf leave ret .trapped: mov eax, 0 jmp .return ENDPROC vmmRCSafeMsrRead ;; ; Safely writes an MSR. ; @returns boolean ; @param uMsr The MSR to red. ; @param u64Value The value to write. ; GLOBALNAME vmmRCSafeMsrWrite push ebp mov ebp, esp pushf cli push esi push edi push ebx push ebp mov ecx, [ebp + 8] ; The MSR to write to. mov eax, [ebp + 12] ; The value to write. mov edx, [ebp + 16] TRPM_GP_HANDLER NAME(TRPMRCTrapHyperHandlerSetEIP), .trapped wrmsr mov eax, 1 .return: pop ebp pop ebx pop edi pop esi popf leave ret .trapped: mov eax, 0 jmp .return ENDPROC vmmRCSafeMsrWrite ;; ; The raw-mode context equivalent of SUPTracerFireProbe. ; ; See also SUPLibTracerA.asm. ; EXPORTEDNAME VMMRCProbeFire push ebp mov ebp, esp ; ; Save edx and eflags so we can use them. ; pushf push edx ; ; Get the address of the tracer context record after first checking ; that host calls hasn't been disabled. ; mov edx, IMP(g_VM) add edx, [edx + VM.offVMCPU] cmp dword [edx + VMCPU.vmm + VMMCPU.cCallRing3Disabled], 0 jnz .return add edx, VMCPU.vmm + VMMCPU.TracerCtx ; ; Save the X86 context. ; mov [edx + SUPDRVTRACERUSRCTX32.u.X86.eax], eax mov [edx + SUPDRVTRACERUSRCTX32.u.X86.ecx], ecx pop eax mov [edx + SUPDRVTRACERUSRCTX32.u.X86.edx], eax mov [edx + SUPDRVTRACERUSRCTX32.u.X86.ebx], ebx mov [edx + SUPDRVTRACERUSRCTX32.u.X86.esi], esi mov [edx + SUPDRVTRACERUSRCTX32.u.X86.edi], edi pop eax mov [edx + SUPDRVTRACERUSRCTX32.u.X86.eflags], eax mov eax, [ebp + 4] mov [edx + SUPDRVTRACERUSRCTX32.u.X86.eip], eax mov eax, [ebp] mov [edx + SUPDRVTRACERUSRCTX32.u.X86.ebp], eax lea eax, [ebp + 4*2] mov [edx + SUPDRVTRACERUSRCTX32.u.X86.esp], eax mov ecx, [ebp + 4*2] mov [edx + SUPDRVTRACERUSRCTX32.u.X86.uVtgProbeLoc], ecx mov eax, [ecx + 4] ; VTGPROBELOC::idProbe. mov [edx + SUPDRVTRACERUSRCTX32.idProbe], eax mov dword [edx + SUPDRVTRACERUSRCTX32.cBits], 32 ; Copy the arguments off the stack. %macro COPY_ONE_ARG 1 mov eax, [ebp + 12 + %1 * 4] mov [edx + SUPDRVTRACERUSRCTX32.u.X86.aArgs + %1*4], eax %endmacro COPY_ONE_ARG 0 COPY_ONE_ARG 1 COPY_ONE_ARG 2 COPY_ONE_ARG 3 COPY_ONE_ARG 4 COPY_ONE_ARG 5 COPY_ONE_ARG 6 COPY_ONE_ARG 7 COPY_ONE_ARG 8 COPY_ONE_ARG 9 COPY_ONE_ARG 10 COPY_ONE_ARG 11 COPY_ONE_ARG 12 COPY_ONE_ARG 13 COPY_ONE_ARG 14 COPY_ONE_ARG 15 COPY_ONE_ARG 16 COPY_ONE_ARG 17 COPY_ONE_ARG 18 COPY_ONE_ARG 19 ; ; Call the helper (too lazy to do the VMM structure stuff). ; mov ecx, IMP(g_VM) push ecx call NAME(vmmRCProbeFireHelper) .return: leave ret ENDPROC VMMRCProbeFire
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r14 push %rbp push %rcx push %rdi push %rsi lea addresses_A_ht+0x21c3, %rsi lea addresses_D_ht+0x5953, %rdi sub $15370, %r14 mov $103, %rcx rep movsw nop add $15437, %r11 lea addresses_UC_ht+0x14933, %r13 nop nop nop nop mfence mov (%r13), %r14w sub %rcx, %rcx lea addresses_A_ht+0x1a043, %rsi lea addresses_D_ht+0x4c3, %rdi nop nop nop nop sub %r10, %r10 mov $46, %rcx rep movsb nop nop nop nop nop add %rcx, %rcx lea addresses_D_ht+0xa843, %r14 nop cmp $51171, %r10 movups (%r14), %xmm1 vpextrq $0, %xmm1, %rcx sub %r13, %r13 lea addresses_A_ht+0xa7c3, %rbp nop nop nop nop nop cmp %rdi, %rdi mov (%rbp), %rsi nop nop nop and $54925, %rdi lea addresses_D_ht+0x13095, %rsi lea addresses_normal_ht+0xc003, %rdi nop add $29568, %r13 mov $94, %rcx rep movsl nop nop nop sub %rcx, %rcx lea addresses_normal_ht+0x18223, %rsi lea addresses_D_ht+0x585, %rdi nop nop nop xor %r11, %r11 mov $4, %rcx rep movsb nop nop nop nop xor $42235, %rbp lea addresses_WT_ht+0x7243, %r10 nop nop nop cmp $12301, %r14 movb $0x61, (%r10) nop nop sub $40634, %rbp lea addresses_UC_ht+0xbac3, %rsi lea addresses_UC_ht+0xbda3, %rdi nop nop nop sub $9557, %r14 mov $84, %rcx rep movsb nop nop xor %rdi, %rdi lea addresses_A_ht+0xfac3, %r13 clflush (%r13) nop and %r10, %r10 mov (%r13), %r14d nop nop nop nop add $62551, %r11 lea addresses_UC_ht+0x1bc43, %rcx nop cmp $33047, %r13 mov $0x6162636465666768, %rsi movq %rsi, %xmm6 movups %xmm6, (%rcx) nop nop nop sub %r11, %r11 lea addresses_normal_ht+0x15043, %r11 nop nop nop nop dec %r13 movl $0x61626364, (%r11) nop nop nop xor $15773, %rsi lea addresses_UC_ht+0x10553, %rsi lea addresses_normal_ht+0x1808b, %rdi clflush (%rdi) nop nop nop nop nop cmp %rbp, %rbp mov $57, %rcx rep movsl sub %r14, %r14 lea addresses_normal_ht+0x1475, %rsi lea addresses_WT_ht+0x61c3, %rdi nop nop nop nop nop dec %r11 mov $101, %rcx rep movsw nop nop nop add %rdi, %rdi pop %rsi pop %rdi pop %rcx pop %rbp pop %r14 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r13 push %r8 push %rcx push %rdi push %rsi // Store lea addresses_normal+0x5c43, %rsi nop nop nop nop cmp $6636, %r10 mov $0x5152535455565758, %rcx movq %rcx, (%rsi) nop sub $34370, %rcx // Store lea addresses_US+0x1a143, %r12 xor $31601, %rdi mov $0x5152535455565758, %rsi movq %rsi, (%r12) nop nop nop xor $8852, %rdi // Faulty Load lea addresses_PSE+0x14843, %rdi nop and %r12, %r12 movups (%rdi), %xmm2 vpextrq $1, %xmm2, %rsi lea oracles, %rdi and $0xff, %rsi shlq $12, %rsi mov (%rdi,%rsi,1), %rsi pop %rsi pop %rdi pop %rcx pop %r8 pop %r13 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': True, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 8}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 3}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}} {'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 7}, 'dst': {'same': True, 'type': 'addresses_UC_ht', 'congruent': 5}} {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
AddJunkCount: MACRO ld hl,JunkCount inc (hl) ENDM SubJunkCount: MACRO ld hl,JunkCount dec (hl) ENDM AddCop: MACRO ld hl,CopCount inc (hl) ENDM SubCop: MACRO ld hl,CopCount dec (hl) ENDM AddPirateCount: MACRO ld hl,PirateCount inc (hl) ENDM SubPirateCount: MACRO ld hl,PirateCount inc (hl) ENDM AreCopsPresent: MACRO ld a,(CopCount) and a ENDM TestRoomForJunk: MACRO Target ld a,3 JumpIfALTMemusng JunkCount, Target ENDM JumpIfSpaceStation: MACRO Target ld hl,UniverseSlotType ld a,(hl) cp ShipTypeStation ENDM ClearSlotMem: MACRO mem ld a,(mem) call ClearSlotA ENDM IsSlotEmpty: MACRO ld hl,UniverseSlotList add hl,a ld a,(hl) cp 0 ENDM ; Checks if slot is empty else A = ship type ReturnIfSlotAEmpty: MACRO ld hl,UniverseSlotList add hl,a ld a,(hl) inc a ret z ; if slot was ff inc would make it 0 dec a ; get original value back for later ENDM JumpIfSlotAEmpty: MACRO Target ld hl,UniverseSlotList add hl,a ld a,(hl) inc a jp z,Target ; if slot was ff inc would make it 0 dec a ; get original value back for later ENDM JumpIfSlotHLEmpty: MACRO Target ld a,(hl) and a jr nz,Target ENDM
/** * @file exponential_schedule.hpp * @author Zhihao Lou * * Exponential (geometric) cooling schedule used in SA. * * ensmallen is free software; you may redistribute it and/or modify it under * the terms of the 3-clause BSD license. You should have received a copy of * the 3-clause BSD license along with ensmallen. If not, see * http://www.opensource.org/licenses/BSD-3-Clause for more information. */ #ifndef ENSMALLEN_SA_EXPONENTIAL_SCHEDULE_HPP #define ENSMALLEN_SA_EXPONENTIAL_SCHEDULE_HPP namespace ens { /** * The exponential cooling schedule cools the temperature T at every step * according to the equation * * \f[ * T_{n+1} = (1-\lambda) T_{n} * \f] * * where \f$ 0<\lambda<1 \f$ is the cooling speed. The smaller \f$ \lambda \f$ * is, the slower the cooling speed, and better the final result will be. Some * literature uses \f$ \alpha = (-1 \lambda) \f$ instead. In practice, * \f$ \alpha \f$ is very close to 1 and will be awkward to input (e.g. * alpha = 0.999999 vs lambda = 1e-6). */ class ExponentialSchedule { public: /* * Construct the ExponentialSchedule with the given parameter. * * @param lambda Cooling speed. */ ExponentialSchedule(const double lambda = 0.001) : lambda(lambda) { } /** * Returns the next temperature given current status. The current system's * energy is not used in this calculation. * * @param currentTemperature Current temperature of system. * @param currentEnergy Current energy of system (not used). */ template<typename ElemType> double NextTemperature( const double currentTemperature, const ElemType /* currentEnergy */) { return (1 - lambda) * currentTemperature; } //! Get the cooling speed, lambda. double Lambda() const { return lambda; } //! Modify the cooling speed, lambda. double& Lambda() { return lambda; } private: //! The cooling speed. double lambda; }; } // namespace ens #endif
; A088682: a(n) = prime(3*n+1) - prime(3*n-1). ; Submitted by Jamie Morken(w2) ; 4,6,10,10,10,8,8,14,6,18,8,8,10,12,6,16,10,16,8,6,18,18,12,14,10,12,12,8,14,6,12,10,20,16,8,12,12,14,6,8,10,18,14,12,12,24,12,6,18,18,6,12,12,20,12,18,8,8,12,24,6,14,28,18,12,16,8,22,6,8,6,8,12,28,6,14,8,12,6,24 mul $0,3 add $0,1 mov $1,$0 seq $0,40 ; The prime numbers. add $1,2 seq $1,40 ; The prime numbers. sub $1,$0 mov $0,$1
/* * Copyright 2004 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "pc/media_session.h" #include <algorithm> #include <functional> #include <map> #include <memory> #include <set> #include <unordered_map> #include <utility> #include "absl/algorithm/container.h" #include "absl/strings/match.h" #include "absl/types/optional.h" #include "api/crypto_params.h" #include "media/base/h264_profile_level_id.h" #include "media/base/media_constants.h" #include "media/sctp/sctp_transport_internal.h" #include "p2p/base/p2p_constants.h" #include "pc/channel_manager.h" #include "pc/media_protocol_names.h" #include "pc/rtp_media_utils.h" #include "pc/srtp_filter.h" #include "pc/used_ids.h" #include "rtc_base/checks.h" #include "rtc_base/helpers.h" #include "rtc_base/logging.h" #include "rtc_base/third_party/base64/base64.h" #include "rtc_base/unique_id_generator.h" namespace { using rtc::UniqueRandomIdGenerator; using webrtc::RtpTransceiverDirection; const char kInline[] = "inline:"; void GetSupportedSdesCryptoSuiteNames( void (*func)(const webrtc::CryptoOptions&, std::vector<int>*), const webrtc::CryptoOptions& crypto_options, std::vector<std::string>* names) { std::vector<int> crypto_suites; func(crypto_options, &crypto_suites); for (const auto crypto : crypto_suites) { names->push_back(rtc::SrtpCryptoSuiteToName(crypto)); } } } // namespace namespace cricket { // RTP Profile names // http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml // RFC4585 const char kMediaProtocolAvpf[] = "RTP/AVPF"; // RFC5124 const char kMediaProtocolDtlsSavpf[] = "UDP/TLS/RTP/SAVPF"; // We always generate offers with "UDP/TLS/RTP/SAVPF" when using DTLS-SRTP, // but we tolerate "RTP/SAVPF" in offers we receive, for compatibility. const char kMediaProtocolSavpf[] = "RTP/SAVPF"; // Note that the below functions support some protocol strings purely for // legacy compatibility, as required by JSEP in Section 5.1.2, Profile Names // and Interoperability. static bool IsDtlsRtp(const std::string& protocol) { // Most-likely values first. return protocol == "UDP/TLS/RTP/SAVPF" || protocol == "TCP/TLS/RTP/SAVPF" || protocol == "UDP/TLS/RTP/SAVP" || protocol == "TCP/TLS/RTP/SAVP"; } static bool IsPlainRtp(const std::string& protocol) { // Most-likely values first. return protocol == "RTP/SAVPF" || protocol == "RTP/AVPF" || protocol == "RTP/SAVP" || protocol == "RTP/AVP"; } static RtpTransceiverDirection NegotiateRtpTransceiverDirection( RtpTransceiverDirection offer, RtpTransceiverDirection wants) { bool offer_send = webrtc::RtpTransceiverDirectionHasSend(offer); bool offer_recv = webrtc::RtpTransceiverDirectionHasRecv(offer); bool wants_send = webrtc::RtpTransceiverDirectionHasSend(wants); bool wants_recv = webrtc::RtpTransceiverDirectionHasRecv(wants); return webrtc::RtpTransceiverDirectionFromSendRecv(offer_recv && wants_send, offer_send && wants_recv); } static bool IsMediaContentOfType(const ContentInfo* content, MediaType media_type) { if (!content || !content->media_description()) { return false; } return content->media_description()->type() == media_type; } static bool CreateCryptoParams(int tag, const std::string& cipher, CryptoParams* crypto_out) { int key_len; int salt_len; if (!rtc::GetSrtpKeyAndSaltLengths(rtc::SrtpCryptoSuiteFromName(cipher), &key_len, &salt_len)) { return false; } int master_key_len = key_len + salt_len; std::string master_key; if (!rtc::CreateRandomData(master_key_len, &master_key)) { return false; } RTC_CHECK_EQ(master_key_len, master_key.size()); std::string key = rtc::Base64::Encode(master_key); crypto_out->tag = tag; crypto_out->cipher_suite = cipher; crypto_out->key_params = kInline; crypto_out->key_params += key; return true; } static bool AddCryptoParams(const std::string& cipher_suite, CryptoParamsVec* cryptos_out) { int size = static_cast<int>(cryptos_out->size()); cryptos_out->resize(size + 1); return CreateCryptoParams(size, cipher_suite, &cryptos_out->at(size)); } void AddMediaCryptos(const CryptoParamsVec& cryptos, MediaContentDescription* media) { for (const CryptoParams& crypto : cryptos) { media->AddCrypto(crypto); } } bool CreateMediaCryptos(const std::vector<std::string>& crypto_suites, MediaContentDescription* media) { CryptoParamsVec cryptos; for (const std::string& crypto_suite : crypto_suites) { if (!AddCryptoParams(crypto_suite, &cryptos)) { return false; } } AddMediaCryptos(cryptos, media); return true; } const CryptoParamsVec* GetCryptos(const ContentInfo* content) { if (!content || !content->media_description()) { return nullptr; } return &content->media_description()->cryptos(); } bool FindMatchingCrypto(const CryptoParamsVec& cryptos, const CryptoParams& crypto, CryptoParams* crypto_out) { auto it = absl::c_find_if( cryptos, [&crypto](const CryptoParams& c) { return crypto.Matches(c); }); if (it == cryptos.end()) { return false; } *crypto_out = *it; return true; } // For audio, HMAC 32 (if enabled) is prefered over HMAC 80 because of the // low overhead. void GetSupportedAudioSdesCryptoSuites( const webrtc::CryptoOptions& crypto_options, std::vector<int>* crypto_suites) { if (crypto_options.srtp.enable_gcm_crypto_suites) { crypto_suites->push_back(rtc::SRTP_AEAD_AES_256_GCM); crypto_suites->push_back(rtc::SRTP_AEAD_AES_128_GCM); } if (crypto_options.srtp.enable_aes128_sha1_32_crypto_cipher) { crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_32); } crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80); } void GetSupportedAudioSdesCryptoSuiteNames( const webrtc::CryptoOptions& crypto_options, std::vector<std::string>* crypto_suite_names) { GetSupportedSdesCryptoSuiteNames(GetSupportedAudioSdesCryptoSuites, crypto_options, crypto_suite_names); } void GetSupportedVideoSdesCryptoSuites( const webrtc::CryptoOptions& crypto_options, std::vector<int>* crypto_suites) { if (crypto_options.srtp.enable_gcm_crypto_suites) { crypto_suites->push_back(rtc::SRTP_AEAD_AES_256_GCM); crypto_suites->push_back(rtc::SRTP_AEAD_AES_128_GCM); } crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80); } void GetSupportedVideoSdesCryptoSuiteNames( const webrtc::CryptoOptions& crypto_options, std::vector<std::string>* crypto_suite_names) { GetSupportedSdesCryptoSuiteNames(GetSupportedVideoSdesCryptoSuites, crypto_options, crypto_suite_names); } void GetSupportedDataSdesCryptoSuites( const webrtc::CryptoOptions& crypto_options, std::vector<int>* crypto_suites) { if (crypto_options.srtp.enable_gcm_crypto_suites) { crypto_suites->push_back(rtc::SRTP_AEAD_AES_256_GCM); crypto_suites->push_back(rtc::SRTP_AEAD_AES_128_GCM); } crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80); } void GetSupportedDataSdesCryptoSuiteNames( const webrtc::CryptoOptions& crypto_options, std::vector<std::string>* crypto_suite_names) { GetSupportedSdesCryptoSuiteNames(GetSupportedDataSdesCryptoSuites, crypto_options, crypto_suite_names); } // Support any GCM cipher (if enabled through options). For video support only // 80-bit SHA1 HMAC. For audio 32-bit HMAC is tolerated (if enabled) unless // bundle is enabled because it is low overhead. // Pick the crypto in the list that is supported. static bool SelectCrypto(const MediaContentDescription* offer, bool bundle, const webrtc::CryptoOptions& crypto_options, CryptoParams* crypto_out) { bool audio = offer->type() == MEDIA_TYPE_AUDIO; const CryptoParamsVec& cryptos = offer->cryptos(); for (const CryptoParams& crypto : cryptos) { if ((crypto_options.srtp.enable_gcm_crypto_suites && rtc::IsGcmCryptoSuiteName(crypto.cipher_suite)) || rtc::CS_AES_CM_128_HMAC_SHA1_80 == crypto.cipher_suite || (rtc::CS_AES_CM_128_HMAC_SHA1_32 == crypto.cipher_suite && audio && !bundle && crypto_options.srtp.enable_aes128_sha1_32_crypto_cipher)) { return CreateCryptoParams(crypto.tag, crypto.cipher_suite, crypto_out); } } return false; } // Finds all StreamParams of all media types and attach them to stream_params. static StreamParamsVec GetCurrentStreamParams( const std::vector<const ContentInfo*>& active_local_contents) { StreamParamsVec stream_params; for (const ContentInfo* content : active_local_contents) { for (const StreamParams& params : content->media_description()->streams()) { stream_params.push_back(params); } } return stream_params; } // Filters the data codecs for the data channel type. void FilterDataCodecs(std::vector<DataCodec>* codecs, bool sctp) { // Filter RTP codec for SCTP and vice versa. const char* codec_name = sctp ? kGoogleRtpDataCodecName : kGoogleSctpDataCodecName; codecs->erase(std::remove_if(codecs->begin(), codecs->end(), [&codec_name](const DataCodec& codec) { return absl::EqualsIgnoreCase(codec.name, codec_name); }), codecs->end()); } static StreamParams CreateStreamParamsForNewSenderWithSsrcs( const SenderOptions& sender, const std::string& rtcp_cname, bool include_rtx_streams, bool include_flexfec_stream, UniqueRandomIdGenerator* ssrc_generator) { StreamParams result; result.id = sender.track_id; // TODO(brandtr): Update when we support multistream protection. if (include_flexfec_stream && sender.num_sim_layers > 1) { include_flexfec_stream = false; RTC_LOG(LS_WARNING) << "Our FlexFEC implementation only supports protecting " "a single media streams. This session has multiple " "media streams however, so no FlexFEC SSRC will be generated."; } result.GenerateSsrcs(sender.num_sim_layers, include_rtx_streams, include_flexfec_stream, ssrc_generator); result.cname = rtcp_cname; result.set_stream_ids(sender.stream_ids); return result; } static bool ValidateSimulcastLayers( const std::vector<RidDescription>& rids, const SimulcastLayerList& simulcast_layers) { return absl::c_all_of( simulcast_layers.GetAllLayers(), [&rids](const SimulcastLayer& layer) { return absl::c_any_of(rids, [&layer](const RidDescription& rid) { return rid.rid == layer.rid; }); }); } static StreamParams CreateStreamParamsForNewSenderWithRids( const SenderOptions& sender, const std::string& rtcp_cname) { RTC_DCHECK(!sender.rids.empty()); RTC_DCHECK_EQ(sender.num_sim_layers, 0) << "RIDs are the compliant way to indicate simulcast."; RTC_DCHECK(ValidateSimulcastLayers(sender.rids, sender.simulcast_layers)); StreamParams result; result.id = sender.track_id; result.cname = rtcp_cname; result.set_stream_ids(sender.stream_ids); // More than one rid should be signaled. if (sender.rids.size() > 1) { result.set_rids(sender.rids); } return result; } // Adds SimulcastDescription if indicated by the media description options. // MediaContentDescription should already be set up with the send rids. static void AddSimulcastToMediaDescription( const MediaDescriptionOptions& media_description_options, MediaContentDescription* description) { RTC_DCHECK(description); // Check if we are using RIDs in this scenario. if (absl::c_all_of(description->streams(), [](const StreamParams& params) { return !params.has_rids(); })) { return; } RTC_DCHECK_EQ(1, description->streams().size()) << "RIDs are only supported in Unified Plan semantics."; RTC_DCHECK_EQ(1, media_description_options.sender_options.size()); RTC_DCHECK(description->type() == MediaType::MEDIA_TYPE_AUDIO || description->type() == MediaType::MEDIA_TYPE_VIDEO); // One RID or less indicates that simulcast is not needed. if (description->streams()[0].rids().size() <= 1) { return; } // Only negotiate the send layers. SimulcastDescription simulcast; simulcast.send_layers() = media_description_options.sender_options[0].simulcast_layers; description->set_simulcast_description(simulcast); } // Adds a StreamParams for each SenderOptions in |sender_options| to // content_description. // |current_params| - All currently known StreamParams of any media type. template <class C> static bool AddStreamParams( const std::vector<SenderOptions>& sender_options, const std::string& rtcp_cname, UniqueRandomIdGenerator* ssrc_generator, StreamParamsVec* current_streams, MediaContentDescriptionImpl<C>* content_description) { // SCTP streams are not negotiated using SDP/ContentDescriptions. if (IsSctpProtocol(content_description->protocol())) { return true; } const bool include_rtx_streams = ContainsRtxCodec(content_description->codecs()); const bool include_flexfec_stream = ContainsFlexfecCodec(content_description->codecs()); for (const SenderOptions& sender : sender_options) { // groupid is empty for StreamParams generated using // MediaSessionDescriptionFactory. StreamParams* param = GetStreamByIds(*current_streams, "" /*group_id*/, sender.track_id); if (!param) { // This is a new sender. StreamParams stream_param = sender.rids.empty() ? // Signal SSRCs and legacy simulcast (if requested). CreateStreamParamsForNewSenderWithSsrcs( sender, rtcp_cname, include_rtx_streams, include_flexfec_stream, ssrc_generator) : // Signal RIDs and spec-compliant simulcast (if requested). CreateStreamParamsForNewSenderWithRids(sender, rtcp_cname); content_description->AddStream(stream_param); // Store the new StreamParams in current_streams. // This is necessary so that we can use the CNAME for other media types. current_streams->push_back(stream_param); } else { // Use existing generated SSRCs/groups, but update the sync_label if // necessary. This may be needed if a MediaStreamTrack was moved from one // MediaStream to another. param->set_stream_ids(sender.stream_ids); content_description->AddStream(*param); } } return true; } // Updates the transport infos of the |sdesc| according to the given // |bundle_group|. The transport infos of the content names within the // |bundle_group| should be updated to use the ufrag, pwd and DTLS role of the // first content within the |bundle_group|. static bool UpdateTransportInfoForBundle(const ContentGroup& bundle_group, SessionDescription* sdesc) { // The bundle should not be empty. if (!sdesc || !bundle_group.FirstContentName()) { return false; } // We should definitely have a transport for the first content. const std::string& selected_content_name = *bundle_group.FirstContentName(); const TransportInfo* selected_transport_info = sdesc->GetTransportInfoByName(selected_content_name); if (!selected_transport_info) { return false; } // Set the other contents to use the same ICE credentials. const std::string& selected_ufrag = selected_transport_info->description.ice_ufrag; const std::string& selected_pwd = selected_transport_info->description.ice_pwd; ConnectionRole selected_connection_role = selected_transport_info->description.connection_role; const absl::optional<OpaqueTransportParameters>& selected_opaque_parameters = selected_transport_info->description.opaque_parameters; for (TransportInfo& transport_info : sdesc->transport_infos()) { if (bundle_group.HasContentName(transport_info.content_name) && transport_info.content_name != selected_content_name) { transport_info.description.ice_ufrag = selected_ufrag; transport_info.description.ice_pwd = selected_pwd; transport_info.description.connection_role = selected_connection_role; transport_info.description.opaque_parameters = selected_opaque_parameters; } } return true; } // Gets the CryptoParamsVec of the given |content_name| from |sdesc|, and // sets it to |cryptos|. static bool GetCryptosByName(const SessionDescription* sdesc, const std::string& content_name, CryptoParamsVec* cryptos) { if (!sdesc || !cryptos) { return false; } const ContentInfo* content = sdesc->GetContentByName(content_name); if (!content || !content->media_description()) { return false; } *cryptos = content->media_description()->cryptos(); return true; } // Prunes the |target_cryptos| by removing the crypto params (cipher_suite) // which are not available in |filter|. static void PruneCryptos(const CryptoParamsVec& filter, CryptoParamsVec* target_cryptos) { if (!target_cryptos) { return; } target_cryptos->erase( std::remove_if(target_cryptos->begin(), target_cryptos->end(), // Returns true if the |crypto|'s cipher_suite is not // found in |filter|. [&filter](const CryptoParams& crypto) { for (const CryptoParams& entry : filter) { if (entry.cipher_suite == crypto.cipher_suite) return false; } return true; }), target_cryptos->end()); } static bool IsRtpContent(SessionDescription* sdesc, const std::string& content_name) { bool is_rtp = false; ContentInfo* content = sdesc->GetContentByName(content_name); if (content && content->media_description()) { is_rtp = IsRtpProtocol(content->media_description()->protocol()); } return is_rtp; } // Updates the crypto parameters of the |sdesc| according to the given // |bundle_group|. The crypto parameters of all the contents within the // |bundle_group| should be updated to use the common subset of the // available cryptos. static bool UpdateCryptoParamsForBundle(const ContentGroup& bundle_group, SessionDescription* sdesc) { // The bundle should not be empty. if (!sdesc || !bundle_group.FirstContentName()) { return false; } bool common_cryptos_needed = false; // Get the common cryptos. const ContentNames& content_names = bundle_group.content_names(); CryptoParamsVec common_cryptos; bool first = true; for (const std::string& content_name : content_names) { if (!IsRtpContent(sdesc, content_name)) { continue; } // The common cryptos are needed if any of the content does not have DTLS // enabled. if (!sdesc->GetTransportInfoByName(content_name)->description.secure()) { common_cryptos_needed = true; } if (first) { first = false; // Initial the common_cryptos with the first content in the bundle group. if (!GetCryptosByName(sdesc, content_name, &common_cryptos)) { return false; } if (common_cryptos.empty()) { // If there's no crypto params, we should just return. return true; } } else { CryptoParamsVec cryptos; if (!GetCryptosByName(sdesc, content_name, &cryptos)) { return false; } PruneCryptos(cryptos, &common_cryptos); } } if (common_cryptos.empty() && common_cryptos_needed) { return false; } // Update to use the common cryptos. for (const std::string& content_name : content_names) { if (!IsRtpContent(sdesc, content_name)) { continue; } ContentInfo* content = sdesc->GetContentByName(content_name); if (IsMediaContent(content)) { MediaContentDescription* media_desc = content->media_description(); if (!media_desc) { return false; } media_desc->set_cryptos(common_cryptos); } } return true; } static std::vector<const ContentInfo*> GetActiveContents( const SessionDescription& description, const MediaSessionOptions& session_options) { std::vector<const ContentInfo*> active_contents; for (size_t i = 0; i < description.contents().size(); ++i) { RTC_DCHECK_LT(i, session_options.media_description_options.size()); const ContentInfo& content = description.contents()[i]; const MediaDescriptionOptions& media_options = session_options.media_description_options[i]; if (!content.rejected && !media_options.stopped && content.name == media_options.mid) { active_contents.push_back(&content); } } return active_contents; } template <class C> static bool ContainsRtxCodec(const std::vector<C>& codecs) { for (const auto& codec : codecs) { if (IsRtxCodec(codec)) { return true; } } return false; } template <class C> static bool IsRtxCodec(const C& codec) { return absl::EqualsIgnoreCase(codec.name, kRtxCodecName); } template <class C> static bool ContainsFlexfecCodec(const std::vector<C>& codecs) { for (const auto& codec : codecs) { if (IsFlexfecCodec(codec)) { return true; } } return false; } template <class C> static bool IsFlexfecCodec(const C& codec) { return absl::EqualsIgnoreCase(codec.name, kFlexfecCodecName); } // Create a media content to be offered for the given |sender_options|, // according to the given options.rtcp_mux, session_options.is_muc, codecs, // secure_transport, crypto, and current_streams. If we don't currently have // crypto (in current_cryptos) and it is enabled (in secure_policy), crypto is // created (according to crypto_suites). The created content is added to the // offer. static bool CreateContentOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const SecurePolicy& secure_policy, const CryptoParamsVec* current_cryptos, const std::vector<std::string>& crypto_suites, const RtpHeaderExtensions& rtp_extensions, UniqueRandomIdGenerator* ssrc_generator, StreamParamsVec* current_streams, MediaContentDescription* offer) { offer->set_rtcp_mux(session_options.rtcp_mux_enabled); if (offer->type() == cricket::MEDIA_TYPE_VIDEO) { offer->set_rtcp_reduced_size(true); } offer->set_rtp_header_extensions(rtp_extensions); AddSimulcastToMediaDescription(media_description_options, offer); if (secure_policy != SEC_DISABLED) { if (current_cryptos) { AddMediaCryptos(*current_cryptos, offer); } if (offer->cryptos().empty()) { if (!CreateMediaCryptos(crypto_suites, offer)) { return false; } } } if (secure_policy == SEC_REQUIRED && offer->cryptos().empty()) { return false; } return true; } template <class C> static bool CreateMediaContentOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const std::vector<C>& codecs, const SecurePolicy& secure_policy, const CryptoParamsVec* current_cryptos, const std::vector<std::string>& crypto_suites, const RtpHeaderExtensions& rtp_extensions, UniqueRandomIdGenerator* ssrc_generator, StreamParamsVec* current_streams, MediaContentDescriptionImpl<C>* offer) { offer->AddCodecs(codecs); if (!AddStreamParams(media_description_options.sender_options, session_options.rtcp_cname, ssrc_generator, current_streams, offer)) { return false; } return CreateContentOffer(media_description_options, session_options, secure_policy, current_cryptos, crypto_suites, rtp_extensions, ssrc_generator, current_streams, offer); } template <class C> static bool ReferencedCodecsMatch(const std::vector<C>& codecs1, const int codec1_id, const std::vector<C>& codecs2, const int codec2_id) { const C* codec1 = FindCodecById(codecs1, codec1_id); const C* codec2 = FindCodecById(codecs2, codec2_id); return codec1 != nullptr && codec2 != nullptr && codec1->Matches(*codec2); } template <class C> static void NegotiatePacketization(const C& local_codec, const C& remote_codec, C* negotiated_codec) {} template <> void NegotiatePacketization(const VideoCodec& local_codec, const VideoCodec& remote_codec, VideoCodec* negotiated_codec) { negotiated_codec->packetization = VideoCodec::IntersectPacketization(local_codec, remote_codec); } template <class C> static void NegotiateCodecs(const std::vector<C>& local_codecs, const std::vector<C>& offered_codecs, std::vector<C>* negotiated_codecs, bool keep_offer_order) { for (const C& ours : local_codecs) { C theirs; // Note that we intentionally only find one matching codec for each of our // local codecs, in case the remote offer contains duplicate codecs. if (FindMatchingCodec(local_codecs, offered_codecs, ours, &theirs)) { C negotiated = ours; NegotiatePacketization(ours, theirs, &negotiated); negotiated.IntersectFeedbackParams(theirs); if (IsRtxCodec(negotiated)) { const auto apt_it = theirs.params.find(kCodecParamAssociatedPayloadType); // FindMatchingCodec shouldn't return something with no apt value. RTC_DCHECK(apt_it != theirs.params.end()); negotiated.SetParam(kCodecParamAssociatedPayloadType, apt_it->second); } if (absl::EqualsIgnoreCase(ours.name, kH264CodecName)) { webrtc::H264::GenerateProfileLevelIdForAnswer( ours.params, theirs.params, &negotiated.params); } negotiated.id = theirs.id; negotiated.name = theirs.name; negotiated_codecs->push_back(std::move(negotiated)); } } if (keep_offer_order) { // RFC3264: Although the answerer MAY list the formats in their desired // order of preference, it is RECOMMENDED that unless there is a // specific reason, the answerer list formats in the same relative order // they were present in the offer. // This can be skipped when the transceiver has any codec preferences. std::unordered_map<int, int> payload_type_preferences; int preference = static_cast<int>(offered_codecs.size() + 1); for (const C& codec : offered_codecs) { payload_type_preferences[codec.id] = preference--; } absl::c_sort(*negotiated_codecs, [&payload_type_preferences](const C& a, const C& b) { return payload_type_preferences[a.id] > payload_type_preferences[b.id]; }); } } // Finds a codec in |codecs2| that matches |codec_to_match|, which is // a member of |codecs1|. If |codec_to_match| is an RTX codec, both // the codecs themselves and their associated codecs must match. template <class C> static bool FindMatchingCodec(const std::vector<C>& codecs1, const std::vector<C>& codecs2, const C& codec_to_match, C* found_codec) { // |codec_to_match| should be a member of |codecs1|, in order to look up RTX // codecs' associated codecs correctly. If not, that's a programming error. RTC_DCHECK(absl::c_any_of(codecs1, [&codec_to_match](const C& codec) { return &codec == &codec_to_match; })); for (const C& potential_match : codecs2) { if (potential_match.Matches(codec_to_match)) { if (IsRtxCodec(codec_to_match)) { int apt_value_1 = 0; int apt_value_2 = 0; if (!codec_to_match.GetParam(kCodecParamAssociatedPayloadType, &apt_value_1) || !potential_match.GetParam(kCodecParamAssociatedPayloadType, &apt_value_2)) { RTC_LOG(LS_WARNING) << "RTX missing associated payload type."; continue; } if (!ReferencedCodecsMatch(codecs1, apt_value_1, codecs2, apt_value_2)) { continue; } } if (found_codec) { *found_codec = potential_match; } return true; } } return false; } // Find the codec in |codec_list| that |rtx_codec| is associated with. template <class C> static const C* GetAssociatedCodec(const std::vector<C>& codec_list, const C& rtx_codec) { std::string associated_pt_str; if (!rtx_codec.GetParam(kCodecParamAssociatedPayloadType, &associated_pt_str)) { RTC_LOG(LS_WARNING) << "RTX codec " << rtx_codec.name << " is missing an associated payload type."; return nullptr; } int associated_pt; if (!rtc::FromString(associated_pt_str, &associated_pt)) { RTC_LOG(LS_WARNING) << "Couldn't convert payload type " << associated_pt_str << " of RTX codec " << rtx_codec.name << " to an integer."; return nullptr; } // Find the associated reference codec for the reference RTX codec. const C* associated_codec = FindCodecById(codec_list, associated_pt); if (!associated_codec) { RTC_LOG(LS_WARNING) << "Couldn't find associated codec with payload type " << associated_pt << " for RTX codec " << rtx_codec.name << "."; } return associated_codec; } // Adds all codecs from |reference_codecs| to |offered_codecs| that don't // already exist in |offered_codecs| and ensure the payload types don't // collide. template <class C> static void MergeCodecs(const std::vector<C>& reference_codecs, std::vector<C>* offered_codecs, UsedPayloadTypes* used_pltypes) { // Add all new codecs that are not RTX codecs. for (const C& reference_codec : reference_codecs) { if (!IsRtxCodec(reference_codec) && !FindMatchingCodec<C>(reference_codecs, *offered_codecs, reference_codec, nullptr)) { C codec = reference_codec; used_pltypes->FindAndSetIdUsed(&codec); offered_codecs->push_back(codec); } } // Add all new RTX codecs. for (const C& reference_codec : reference_codecs) { if (IsRtxCodec(reference_codec) && !FindMatchingCodec<C>(reference_codecs, *offered_codecs, reference_codec, nullptr)) { C rtx_codec = reference_codec; const C* associated_codec = GetAssociatedCodec(reference_codecs, rtx_codec); if (!associated_codec) { continue; } // Find a codec in the offered list that matches the reference codec. // Its payload type may be different than the reference codec. C matching_codec; if (!FindMatchingCodec<C>(reference_codecs, *offered_codecs, *associated_codec, &matching_codec)) { RTC_LOG(LS_WARNING) << "Couldn't find matching " << associated_codec->name << " codec."; continue; } rtx_codec.params[kCodecParamAssociatedPayloadType] = rtc::ToString(matching_codec.id); used_pltypes->FindAndSetIdUsed(&rtx_codec); offered_codecs->push_back(rtx_codec); } } } template <typename Codecs> static Codecs MatchCodecPreference( const std::vector<webrtc::RtpCodecCapability>& codec_preferences, const Codecs& codecs) { Codecs filtered_codecs; std::set<std::string> kept_codecs_ids; bool want_rtx = false; for (const auto& codec_preference : codec_preferences) { auto found_codec = absl::c_find_if( codecs, [&codec_preference](const typename Codecs::value_type& codec) { webrtc::RtpCodecParameters codec_parameters = codec.ToCodecParameters(); return codec_parameters.name == codec_preference.name && codec_parameters.kind == codec_preference.kind && codec_parameters.num_channels == codec_preference.num_channels && codec_parameters.clock_rate == codec_preference.clock_rate && codec_parameters.parameters == codec_preference.parameters; }); if (found_codec != codecs.end()) { filtered_codecs.push_back(*found_codec); kept_codecs_ids.insert(std::to_string(found_codec->id)); } else if (IsRtxCodec(codec_preference)) { want_rtx = true; } } if (want_rtx) { for (const auto& codec : codecs) { if (IsRtxCodec(codec)) { const auto apt = codec.params.find(cricket::kCodecParamAssociatedPayloadType); if (apt != codec.params.end() && kept_codecs_ids.count(apt->second) > 0) { filtered_codecs.push_back(codec); } } } } return filtered_codecs; } static bool FindByUriAndEncryption(const RtpHeaderExtensions& extensions, const webrtc::RtpExtension& ext_to_match, webrtc::RtpExtension* found_extension) { auto it = absl::c_find_if( extensions, [&ext_to_match](const webrtc::RtpExtension& extension) { // We assume that all URIs are given in a canonical // format. return extension.uri == ext_to_match.uri && extension.encrypt == ext_to_match.encrypt; }); if (it == extensions.end()) { return false; } if (found_extension) { *found_extension = *it; } return true; } static bool FindByUri(const RtpHeaderExtensions& extensions, const webrtc::RtpExtension& ext_to_match, webrtc::RtpExtension* found_extension) { // We assume that all URIs are given in a canonical format. const webrtc::RtpExtension* found = webrtc::RtpExtension::FindHeaderExtensionByUri(extensions, ext_to_match.uri); if (!found) { return false; } if (found_extension) { *found_extension = *found; } return true; } static bool FindByUriWithEncryptionPreference( const RtpHeaderExtensions& extensions, const webrtc::RtpExtension& ext_to_match, bool encryption_preference, webrtc::RtpExtension* found_extension) { const webrtc::RtpExtension* unencrypted_extension = nullptr; for (const webrtc::RtpExtension& extension : extensions) { // We assume that all URIs are given in a canonical format. if (extension.uri == ext_to_match.uri) { if (!encryption_preference || extension.encrypt) { if (found_extension) { *found_extension = extension; } return true; } unencrypted_extension = &extension; } } if (unencrypted_extension) { if (found_extension) { *found_extension = *unencrypted_extension; } return true; } return false; } // Adds all extensions from |reference_extensions| to |offered_extensions| that // don't already exist in |offered_extensions| and ensure the IDs don't // collide. If an extension is added, it's also added to |regular_extensions| or // |encrypted_extensions|, and if the extension is in |regular_extensions| or // |encrypted_extensions|, its ID is marked as used in |used_ids|. // |offered_extensions| is for either audio or video while |regular_extensions| // and |encrypted_extensions| are used for both audio and video. There could be // overlap between audio extensions and video extensions. static void MergeRtpHdrExts(const RtpHeaderExtensions& reference_extensions, RtpHeaderExtensions* offered_extensions, RtpHeaderExtensions* regular_extensions, RtpHeaderExtensions* encrypted_extensions, UsedRtpHeaderExtensionIds* used_ids) { for (auto reference_extension : reference_extensions) { if (!FindByUriAndEncryption(*offered_extensions, reference_extension, nullptr)) { webrtc::RtpExtension existing; if (reference_extension.encrypt) { if (FindByUriAndEncryption(*encrypted_extensions, reference_extension, &existing)) { offered_extensions->push_back(existing); } else { used_ids->FindAndSetIdUsed(&reference_extension); encrypted_extensions->push_back(reference_extension); offered_extensions->push_back(reference_extension); } } else { if (FindByUriAndEncryption(*regular_extensions, reference_extension, &existing)) { offered_extensions->push_back(existing); } else { used_ids->FindAndSetIdUsed(&reference_extension); regular_extensions->push_back(reference_extension); offered_extensions->push_back(reference_extension); } } } } } static void AddEncryptedVersionsOfHdrExts(RtpHeaderExtensions* extensions, RtpHeaderExtensions* all_extensions, UsedRtpHeaderExtensionIds* used_ids) { RtpHeaderExtensions encrypted_extensions; for (const webrtc::RtpExtension& extension : *extensions) { webrtc::RtpExtension existing; // Don't add encrypted extensions again that were already included in a // previous offer or regular extensions that are also included as encrypted // extensions. if (extension.encrypt || !webrtc::RtpExtension::IsEncryptionSupported(extension.uri) || (FindByUriWithEncryptionPreference(*extensions, extension, true, &existing) && existing.encrypt)) { continue; } if (FindByUri(*all_extensions, extension, &existing)) { encrypted_extensions.push_back(existing); } else { webrtc::RtpExtension encrypted(extension); encrypted.encrypt = true; used_ids->FindAndSetIdUsed(&encrypted); all_extensions->push_back(encrypted); encrypted_extensions.push_back(encrypted); } } extensions->insert(extensions->end(), encrypted_extensions.begin(), encrypted_extensions.end()); } static void NegotiateRtpHeaderExtensions( const RtpHeaderExtensions& local_extensions, const RtpHeaderExtensions& offered_extensions, bool enable_encrypted_rtp_header_extensions, RtpHeaderExtensions* negotiated_extensions) { // TransportSequenceNumberV2 is not offered by default. The special logic for // the TransportSequenceNumber extensions works as follows: // Offer Answer // V1 V1 if in local_extensions. // V1 and V2 V2 regardless of local_extensions. // V2 V2 regardless of local_extensions. const webrtc::RtpExtension* transport_sequence_number_v2_offer = webrtc::RtpExtension::FindHeaderExtensionByUri( offered_extensions, webrtc::RtpExtension::kTransportSequenceNumberV2Uri); for (const webrtc::RtpExtension& ours : local_extensions) { webrtc::RtpExtension theirs; if (FindByUriWithEncryptionPreference( offered_extensions, ours, enable_encrypted_rtp_header_extensions, &theirs)) { if (transport_sequence_number_v2_offer && ours.uri == webrtc::RtpExtension::kTransportSequenceNumberUri) { // Don't respond to // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 // if we get an offer including // http://www.webrtc.org/experiments/rtp-hdrext/transport-wide-cc-02 continue; } else { // We respond with their RTP header extension id. negotiated_extensions->push_back(theirs); } } } if (transport_sequence_number_v2_offer) { // Respond that we support kTransportSequenceNumberV2Uri. negotiated_extensions->push_back(*transport_sequence_number_v2_offer); } } static void StripCNCodecs(AudioCodecs* audio_codecs) { audio_codecs->erase(std::remove_if(audio_codecs->begin(), audio_codecs->end(), [](const AudioCodec& codec) { return absl::EqualsIgnoreCase( codec.name, kComfortNoiseCodecName); }), audio_codecs->end()); } template <class C> static bool SetCodecsInAnswer( const MediaContentDescriptionImpl<C>* offer, const std::vector<C>& local_codecs, const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, UniqueRandomIdGenerator* ssrc_generator, StreamParamsVec* current_streams, MediaContentDescriptionImpl<C>* answer) { std::vector<C> negotiated_codecs; NegotiateCodecs(local_codecs, offer->codecs(), &negotiated_codecs, media_description_options.codec_preferences.empty()); answer->AddCodecs(negotiated_codecs); answer->set_protocol(offer->protocol()); if (!AddStreamParams(media_description_options.sender_options, session_options.rtcp_cname, ssrc_generator, current_streams, answer)) { return false; // Something went seriously wrong. } return true; } // Create a media content to be answered for the given |sender_options| // according to the given session_options.rtcp_mux, session_options.streams, // codecs, crypto, and current_streams. If we don't currently have crypto (in // current_cryptos) and it is enabled (in secure_policy), crypto is created // (according to crypto_suites). The codecs, rtcp_mux, and crypto are all // negotiated with the offer. If the negotiation fails, this method returns // false. The created content is added to the offer. static bool CreateMediaContentAnswer( const MediaContentDescription* offer, const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const SecurePolicy& sdes_policy, const CryptoParamsVec* current_cryptos, const RtpHeaderExtensions& local_rtp_extenstions, UniqueRandomIdGenerator* ssrc_generator, bool enable_encrypted_rtp_header_extensions, StreamParamsVec* current_streams, bool bundle_enabled, MediaContentDescription* answer) { answer->set_extmap_allow_mixed_enum(offer->extmap_allow_mixed_enum()); RtpHeaderExtensions negotiated_rtp_extensions; NegotiateRtpHeaderExtensions( local_rtp_extenstions, offer->rtp_header_extensions(), enable_encrypted_rtp_header_extensions, &negotiated_rtp_extensions); answer->set_rtp_header_extensions(negotiated_rtp_extensions); answer->set_rtcp_mux(session_options.rtcp_mux_enabled && offer->rtcp_mux()); if (answer->type() == cricket::MEDIA_TYPE_VIDEO) { answer->set_rtcp_reduced_size(offer->rtcp_reduced_size()); } answer->set_remote_estimate(offer->remote_estimate()); if (sdes_policy != SEC_DISABLED) { CryptoParams crypto; if (SelectCrypto(offer, bundle_enabled, session_options.crypto_options, &crypto)) { if (current_cryptos) { FindMatchingCrypto(*current_cryptos, crypto, &crypto); } answer->AddCrypto(crypto); } } if (answer->cryptos().empty() && sdes_policy == SEC_REQUIRED) { return false; } AddSimulcastToMediaDescription(media_description_options, answer); answer->set_direction(NegotiateRtpTransceiverDirection( offer->direction(), media_description_options.direction)); return true; } static bool IsMediaProtocolSupported(MediaType type, const std::string& protocol, bool secure_transport) { // Since not all applications serialize and deserialize the media protocol, // we will have to accept |protocol| to be empty. if (protocol.empty()) { return true; } if (type == MEDIA_TYPE_DATA) { // Check for SCTP, but also for RTP for RTP-based data channels. // TODO(pthatcher): Remove RTP once RTP-based data channels are gone. if (secure_transport) { // Most likely scenarios first. return IsDtlsSctp(protocol) || IsDtlsRtp(protocol) || IsPlainRtp(protocol); } else { return IsPlainSctp(protocol) || IsPlainRtp(protocol); } } // Allow for non-DTLS RTP protocol even when using DTLS because that's what // JSEP specifies. if (secure_transport) { // Most likely scenarios first. return IsDtlsRtp(protocol) || IsPlainRtp(protocol); } else { return IsPlainRtp(protocol); } } static void SetMediaProtocol(bool secure_transport, MediaContentDescription* desc) { if (!desc->cryptos().empty()) desc->set_protocol(kMediaProtocolSavpf); else if (secure_transport) desc->set_protocol(kMediaProtocolDtlsSavpf); else desc->set_protocol(kMediaProtocolAvpf); } // Gets the TransportInfo of the given |content_name| from the // |current_description|. If doesn't exist, returns a new one. static const TransportDescription* GetTransportDescription( const std::string& content_name, const SessionDescription* current_description) { const TransportDescription* desc = NULL; if (current_description) { const TransportInfo* info = current_description->GetTransportInfoByName(content_name); if (info) { desc = &info->description; } } return desc; } // Gets the current DTLS state from the transport description. static bool IsDtlsActive(const ContentInfo* content, const SessionDescription* current_description) { if (!content) { return false; } size_t msection_index = content - &current_description->contents()[0]; if (current_description->transport_infos().size() <= msection_index) { return false; } return current_description->transport_infos()[msection_index] .description.secure(); } void MediaDescriptionOptions::AddAudioSender( const std::string& track_id, const std::vector<std::string>& stream_ids) { RTC_DCHECK(type == MEDIA_TYPE_AUDIO); AddSenderInternal(track_id, stream_ids, {}, SimulcastLayerList(), 1); } void MediaDescriptionOptions::AddVideoSender( const std::string& track_id, const std::vector<std::string>& stream_ids, const std::vector<RidDescription>& rids, const SimulcastLayerList& simulcast_layers, int num_sim_layers) { RTC_DCHECK(type == MEDIA_TYPE_VIDEO); RTC_DCHECK(rids.empty() || num_sim_layers == 0) << "RIDs are the compliant way to indicate simulcast."; RTC_DCHECK(ValidateSimulcastLayers(rids, simulcast_layers)); AddSenderInternal(track_id, stream_ids, rids, simulcast_layers, num_sim_layers); } void MediaDescriptionOptions::AddRtpDataChannel(const std::string& track_id, const std::string& stream_id) { RTC_DCHECK(type == MEDIA_TYPE_DATA); // TODO(steveanton): Is it the case that RtpDataChannel will never have more // than one stream? AddSenderInternal(track_id, {stream_id}, {}, SimulcastLayerList(), 1); } void MediaDescriptionOptions::AddSenderInternal( const std::string& track_id, const std::vector<std::string>& stream_ids, const std::vector<RidDescription>& rids, const SimulcastLayerList& simulcast_layers, int num_sim_layers) { // TODO(steveanton): Support any number of stream ids. RTC_CHECK(stream_ids.size() == 1U); SenderOptions options; options.track_id = track_id; options.stream_ids = stream_ids; options.simulcast_layers = simulcast_layers; options.rids = rids; options.num_sim_layers = num_sim_layers; sender_options.push_back(options); } bool MediaSessionOptions::HasMediaDescription(MediaType type) const { return absl::c_any_of( media_description_options, [type](const MediaDescriptionOptions& t) { return t.type == type; }); } MediaSessionDescriptionFactory::MediaSessionDescriptionFactory( const TransportDescriptionFactory* transport_desc_factory, rtc::UniqueRandomIdGenerator* ssrc_generator) : ssrc_generator_(ssrc_generator), transport_desc_factory_(transport_desc_factory) { RTC_DCHECK(ssrc_generator_); } MediaSessionDescriptionFactory::MediaSessionDescriptionFactory( ChannelManager* channel_manager, const TransportDescriptionFactory* transport_desc_factory, rtc::UniqueRandomIdGenerator* ssrc_generator) : MediaSessionDescriptionFactory(transport_desc_factory, ssrc_generator) { channel_manager->GetSupportedAudioSendCodecs(&audio_send_codecs_); channel_manager->GetSupportedAudioReceiveCodecs(&audio_recv_codecs_); channel_manager->GetSupportedAudioRtpHeaderExtensions(&audio_rtp_extensions_); channel_manager->GetSupportedVideoCodecs(&video_codecs_); channel_manager->GetSupportedVideoRtpHeaderExtensions(&video_rtp_extensions_); channel_manager->GetSupportedDataCodecs(&rtp_data_codecs_); ComputeAudioCodecsIntersectionAndUnion(); } const AudioCodecs& MediaSessionDescriptionFactory::audio_sendrecv_codecs() const { return audio_sendrecv_codecs_; } const AudioCodecs& MediaSessionDescriptionFactory::audio_send_codecs() const { return audio_send_codecs_; } const AudioCodecs& MediaSessionDescriptionFactory::audio_recv_codecs() const { return audio_recv_codecs_; } void MediaSessionDescriptionFactory::set_audio_codecs( const AudioCodecs& send_codecs, const AudioCodecs& recv_codecs) { audio_send_codecs_ = send_codecs; audio_recv_codecs_ = recv_codecs; ComputeAudioCodecsIntersectionAndUnion(); } static void AddUnifiedPlanExtensions(RtpHeaderExtensions* extensions) { RTC_DCHECK(extensions); rtc::UniqueNumberGenerator<int> unique_id_generator; unique_id_generator.AddKnownId(0); // The first valid RTP extension ID is 1. for (const webrtc::RtpExtension& extension : *extensions) { const bool collision_free = unique_id_generator.AddKnownId(extension.id); RTC_DCHECK(collision_free); } // Unified Plan also offers the MID and RID header extensions. extensions->push_back(webrtc::RtpExtension(webrtc::RtpExtension::kMidUri, unique_id_generator())); extensions->push_back(webrtc::RtpExtension(webrtc::RtpExtension::kRidUri, unique_id_generator())); extensions->push_back(webrtc::RtpExtension( webrtc::RtpExtension::kRepairedRidUri, unique_id_generator())); } RtpHeaderExtensions MediaSessionDescriptionFactory::audio_rtp_header_extensions() const { RtpHeaderExtensions extensions = audio_rtp_extensions_; if (is_unified_plan_) { AddUnifiedPlanExtensions(&extensions); } return extensions; } RtpHeaderExtensions MediaSessionDescriptionFactory::video_rtp_header_extensions() const { RtpHeaderExtensions extensions = video_rtp_extensions_; if (is_unified_plan_) { AddUnifiedPlanExtensions(&extensions); } return extensions; } std::unique_ptr<SessionDescription> MediaSessionDescriptionFactory::CreateOffer( const MediaSessionOptions& session_options, const SessionDescription* current_description) const { // Must have options for each existing section. if (current_description) { RTC_DCHECK_LE(current_description->contents().size(), session_options.media_description_options.size()); } IceCredentialsIterator ice_credentials( session_options.pooled_ice_credentials); std::vector<const ContentInfo*> current_active_contents; if (current_description) { current_active_contents = GetActiveContents(*current_description, session_options); } StreamParamsVec current_streams = GetCurrentStreamParams(current_active_contents); AudioCodecs offer_audio_codecs; VideoCodecs offer_video_codecs; RtpDataCodecs offer_rtp_data_codecs; GetCodecsForOffer(current_active_contents, &offer_audio_codecs, &offer_video_codecs, &offer_rtp_data_codecs); if (!session_options.vad_enabled) { // If application doesn't want CN codecs in offer. StripCNCodecs(&offer_audio_codecs); } FilterDataCodecs(&offer_rtp_data_codecs, session_options.data_channel_type == DCT_SCTP); RtpHeaderExtensions audio_rtp_extensions; RtpHeaderExtensions video_rtp_extensions; GetRtpHdrExtsToOffer(current_active_contents, session_options.offer_extmap_allow_mixed, &audio_rtp_extensions, &video_rtp_extensions); auto offer = std::make_unique<SessionDescription>(); // Iterate through the media description options, matching with existing media // descriptions in |current_description|. size_t msection_index = 0; for (const MediaDescriptionOptions& media_description_options : session_options.media_description_options) { const ContentInfo* current_content = nullptr; if (current_description && msection_index < current_description->contents().size()) { current_content = &current_description->contents()[msection_index]; // Media type must match unless this media section is being recycled. RTC_DCHECK(current_content->name != media_description_options.mid || IsMediaContentOfType(current_content, media_description_options.type)); } switch (media_description_options.type) { case MEDIA_TYPE_AUDIO: if (!AddAudioContentForOffer( media_description_options, session_options, current_content, current_description, audio_rtp_extensions, offer_audio_codecs, &current_streams, offer.get(), &ice_credentials)) { return nullptr; } break; case MEDIA_TYPE_VIDEO: if (!AddVideoContentForOffer( media_description_options, session_options, current_content, current_description, video_rtp_extensions, offer_video_codecs, &current_streams, offer.get(), &ice_credentials)) { return nullptr; } break; case MEDIA_TYPE_DATA: if (!AddDataContentForOffer(media_description_options, session_options, current_content, current_description, offer_rtp_data_codecs, &current_streams, offer.get(), &ice_credentials)) { return nullptr; } break; default: RTC_NOTREACHED(); } ++msection_index; } // Bundle the contents together, if we've been asked to do so, and update any // parameters that need to be tweaked for BUNDLE. if (session_options.bundle_enabled) { ContentGroup offer_bundle(GROUP_TYPE_BUNDLE); for (const ContentInfo& content : offer->contents()) { if (content.rejected) { continue; } // TODO(deadbeef): There are conditions that make bundling two media // descriptions together illegal. For example, they use the same payload // type to represent different codecs, or same IDs for different header // extensions. We need to detect this and not try to bundle those media // descriptions together. offer_bundle.AddContentName(content.name); } if (!offer_bundle.content_names().empty()) { offer->AddGroup(offer_bundle); if (!UpdateTransportInfoForBundle(offer_bundle, offer.get())) { RTC_LOG(LS_ERROR) << "CreateOffer failed to UpdateTransportInfoForBundle."; return nullptr; } if (!UpdateCryptoParamsForBundle(offer_bundle, offer.get())) { RTC_LOG(LS_ERROR) << "CreateOffer failed to UpdateCryptoParamsForBundle."; return nullptr; } } } // The following determines how to signal MSIDs to ensure compatibility with // older endpoints (in particular, older Plan B endpoints). if (is_unified_plan_) { // Be conservative and signal using both a=msid and a=ssrc lines. Unified // Plan answerers will look at a=msid and Plan B answerers will look at the // a=ssrc MSID line. offer->set_msid_signaling(cricket::kMsidSignalingMediaSection | cricket::kMsidSignalingSsrcAttribute); } else { // Plan B always signals MSID using a=ssrc lines. offer->set_msid_signaling(cricket::kMsidSignalingSsrcAttribute); } offer->set_extmap_allow_mixed(session_options.offer_extmap_allow_mixed); if (session_options.media_transport_settings.has_value()) { offer->AddMediaTransportSetting( session_options.media_transport_settings->transport_name, session_options.media_transport_settings->transport_setting); } return offer; } std::unique_ptr<SessionDescription> MediaSessionDescriptionFactory::CreateAnswer( const SessionDescription* offer, const MediaSessionOptions& session_options, const SessionDescription* current_description) const { if (!offer) { return nullptr; } // Must have options for exactly as many sections as in the offer. RTC_DCHECK_EQ(offer->contents().size(), session_options.media_description_options.size()); IceCredentialsIterator ice_credentials( session_options.pooled_ice_credentials); std::vector<const ContentInfo*> current_active_contents; if (current_description) { current_active_contents = GetActiveContents(*current_description, session_options); } StreamParamsVec current_streams = GetCurrentStreamParams(current_active_contents); // Get list of all possible codecs that respects existing payload type // mappings and uses a single payload type space. // // Note that these lists may be further filtered for each m= section; this // step is done just to establish the payload type mappings shared by all // sections. AudioCodecs answer_audio_codecs; VideoCodecs answer_video_codecs; RtpDataCodecs answer_rtp_data_codecs; GetCodecsForAnswer(current_active_contents, *offer, &answer_audio_codecs, &answer_video_codecs, &answer_rtp_data_codecs); if (!session_options.vad_enabled) { // If application doesn't want CN codecs in answer. StripCNCodecs(&answer_audio_codecs); } FilterDataCodecs(&answer_rtp_data_codecs, session_options.data_channel_type == DCT_SCTP); auto answer = std::make_unique<SessionDescription>(); // If the offer supports BUNDLE, and we want to use it too, create a BUNDLE // group in the answer with the appropriate content names. const ContentGroup* offer_bundle = offer->GetGroupByName(GROUP_TYPE_BUNDLE); ContentGroup answer_bundle(GROUP_TYPE_BUNDLE); // Transport info shared by the bundle group. std::unique_ptr<TransportInfo> bundle_transport; answer->set_extmap_allow_mixed(offer->extmap_allow_mixed()); // Iterate through the media description options, matching with existing // media descriptions in |current_description|. size_t msection_index = 0; for (const MediaDescriptionOptions& media_description_options : session_options.media_description_options) { const ContentInfo* offer_content = &offer->contents()[msection_index]; // Media types and MIDs must match between the remote offer and the // MediaDescriptionOptions. RTC_DCHECK( IsMediaContentOfType(offer_content, media_description_options.type)); RTC_DCHECK(media_description_options.mid == offer_content->name); const ContentInfo* current_content = nullptr; if (current_description && msection_index < current_description->contents().size()) { current_content = &current_description->contents()[msection_index]; } switch (media_description_options.type) { case MEDIA_TYPE_AUDIO: if (!AddAudioContentForAnswer( media_description_options, session_options, offer_content, offer, current_content, current_description, bundle_transport.get(), answer_audio_codecs, &current_streams, answer.get(), &ice_credentials)) { return nullptr; } break; case MEDIA_TYPE_VIDEO: if (!AddVideoContentForAnswer( media_description_options, session_options, offer_content, offer, current_content, current_description, bundle_transport.get(), answer_video_codecs, &current_streams, answer.get(), &ice_credentials)) { return nullptr; } break; case MEDIA_TYPE_DATA: if (!AddDataContentForAnswer( media_description_options, session_options, offer_content, offer, current_content, current_description, bundle_transport.get(), answer_rtp_data_codecs, &current_streams, answer.get(), &ice_credentials)) { return nullptr; } break; default: RTC_NOTREACHED(); } ++msection_index; // See if we can add the newly generated m= section to the BUNDLE group in // the answer. ContentInfo& added = answer->contents().back(); if (!added.rejected && session_options.bundle_enabled && offer_bundle && offer_bundle->HasContentName(added.name)) { answer_bundle.AddContentName(added.name); bundle_transport.reset( new TransportInfo(*answer->GetTransportInfoByName(added.name))); } } // If a BUNDLE group was offered, put a BUNDLE group in the answer even if // it's empty. RFC5888 says: // // A SIP entity that receives an offer that contains an "a=group" line // with semantics that are understood MUST return an answer that // contains an "a=group" line with the same semantics. if (offer_bundle) { answer->AddGroup(answer_bundle); } if (answer_bundle.FirstContentName()) { // Share the same ICE credentials and crypto params across all contents, // as BUNDLE requires. if (!UpdateTransportInfoForBundle(answer_bundle, answer.get())) { RTC_LOG(LS_ERROR) << "CreateAnswer failed to UpdateTransportInfoForBundle."; return NULL; } if (!UpdateCryptoParamsForBundle(answer_bundle, answer.get())) { RTC_LOG(LS_ERROR) << "CreateAnswer failed to UpdateCryptoParamsForBundle."; return NULL; } } // The following determines how to signal MSIDs to ensure compatibility with // older endpoints (in particular, older Plan B endpoints). if (is_unified_plan_) { // Unified Plan needs to look at what the offer included to find the most // compatible answer. if (offer->msid_signaling() == 0) { // We end up here in one of three cases: // 1. An empty offer. We'll reply with an empty answer so it doesn't // matter what we pick here. // 2. A data channel only offer. We won't add any MSIDs to the answer so // it also doesn't matter what we pick here. // 3. Media that's either sendonly or inactive from the remote endpoint. // We don't have any information to say whether the endpoint is Plan B // or Unified Plan, so be conservative and send both. answer->set_msid_signaling(cricket::kMsidSignalingMediaSection | cricket::kMsidSignalingSsrcAttribute); } else if (offer->msid_signaling() == (cricket::kMsidSignalingMediaSection | cricket::kMsidSignalingSsrcAttribute)) { // If both a=msid and a=ssrc MSID signaling methods were used, we're // probably talking to a Unified Plan endpoint so respond with just // a=msid. answer->set_msid_signaling(cricket::kMsidSignalingMediaSection); } else { // Otherwise, it's clear which method the offerer is using so repeat that // back to them. answer->set_msid_signaling(offer->msid_signaling()); } } else { // Plan B always signals MSID using a=ssrc lines. answer->set_msid_signaling(cricket::kMsidSignalingSsrcAttribute); } return answer; } const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForOffer( const RtpTransceiverDirection& direction) const { switch (direction) { // If stream is inactive - generate list as if sendrecv. case RtpTransceiverDirection::kSendRecv: case RtpTransceiverDirection::kInactive: return audio_sendrecv_codecs_; case RtpTransceiverDirection::kSendOnly: return audio_send_codecs_; case RtpTransceiverDirection::kRecvOnly: return audio_recv_codecs_; } RTC_NOTREACHED(); return audio_sendrecv_codecs_; } const AudioCodecs& MediaSessionDescriptionFactory::GetAudioCodecsForAnswer( const RtpTransceiverDirection& offer, const RtpTransceiverDirection& answer) const { switch (answer) { // For inactive and sendrecv answers, generate lists as if we were to accept // the offer's direction. See RFC 3264 Section 6.1. case RtpTransceiverDirection::kSendRecv: case RtpTransceiverDirection::kInactive: return GetAudioCodecsForOffer( webrtc::RtpTransceiverDirectionReversed(offer)); case RtpTransceiverDirection::kSendOnly: return audio_send_codecs_; case RtpTransceiverDirection::kRecvOnly: return audio_recv_codecs_; } RTC_NOTREACHED(); return audio_sendrecv_codecs_; } void MergeCodecsFromDescription( const std::vector<const ContentInfo*>& current_active_contents, AudioCodecs* audio_codecs, VideoCodecs* video_codecs, RtpDataCodecs* rtp_data_codecs, UsedPayloadTypes* used_pltypes) { for (const ContentInfo* content : current_active_contents) { if (IsMediaContentOfType(content, MEDIA_TYPE_AUDIO)) { const AudioContentDescription* audio = content->media_description()->as_audio(); MergeCodecs<AudioCodec>(audio->codecs(), audio_codecs, used_pltypes); } else if (IsMediaContentOfType(content, MEDIA_TYPE_VIDEO)) { const VideoContentDescription* video = content->media_description()->as_video(); MergeCodecs<VideoCodec>(video->codecs(), video_codecs, used_pltypes); } else if (IsMediaContentOfType(content, MEDIA_TYPE_DATA)) { const RtpDataContentDescription* data = content->media_description()->as_rtp_data(); if (data) { // Only relevant for RTP datachannels MergeCodecs<RtpDataCodec>(data->codecs(), rtp_data_codecs, used_pltypes); } } } } // Getting codecs for an offer involves these steps: // // 1. Construct payload type -> codec mappings for current description. // 2. Add any reference codecs that weren't already present // 3. For each individual media description (m= section), filter codecs based // on the directional attribute (happens in another method). void MediaSessionDescriptionFactory::GetCodecsForOffer( const std::vector<const ContentInfo*>& current_active_contents, AudioCodecs* audio_codecs, VideoCodecs* video_codecs, RtpDataCodecs* rtp_data_codecs) const { // First - get all codecs from the current description if the media type // is used. Add them to |used_pltypes| so the payload type is not reused if a // new media type is added. UsedPayloadTypes used_pltypes; MergeCodecsFromDescription(current_active_contents, audio_codecs, video_codecs, rtp_data_codecs, &used_pltypes); // Add our codecs that are not in the current description. MergeCodecs<AudioCodec>(all_audio_codecs_, audio_codecs, &used_pltypes); MergeCodecs<VideoCodec>(video_codecs_, video_codecs, &used_pltypes); MergeCodecs<DataCodec>(rtp_data_codecs_, rtp_data_codecs, &used_pltypes); } // Getting codecs for an answer involves these steps: // // 1. Construct payload type -> codec mappings for current description. // 2. Add any codecs from the offer that weren't already present. // 3. Add any remaining codecs that weren't already present. // 4. For each individual media description (m= section), filter codecs based // on the directional attribute (happens in another method). void MediaSessionDescriptionFactory::GetCodecsForAnswer( const std::vector<const ContentInfo*>& current_active_contents, const SessionDescription& remote_offer, AudioCodecs* audio_codecs, VideoCodecs* video_codecs, RtpDataCodecs* rtp_data_codecs) const { // First - get all codecs from the current description if the media type // is used. Add them to |used_pltypes| so the payload type is not reused if a // new media type is added. UsedPayloadTypes used_pltypes; MergeCodecsFromDescription(current_active_contents, audio_codecs, video_codecs, rtp_data_codecs, &used_pltypes); // Second - filter out codecs that we don't support at all and should ignore. AudioCodecs filtered_offered_audio_codecs; VideoCodecs filtered_offered_video_codecs; RtpDataCodecs filtered_offered_rtp_data_codecs; for (const ContentInfo& content : remote_offer.contents()) { if (IsMediaContentOfType(&content, MEDIA_TYPE_AUDIO)) { const AudioContentDescription* audio = content.media_description()->as_audio(); for (const AudioCodec& offered_audio_codec : audio->codecs()) { if (!FindMatchingCodec<AudioCodec>(audio->codecs(), filtered_offered_audio_codecs, offered_audio_codec, nullptr) && FindMatchingCodec<AudioCodec>(audio->codecs(), all_audio_codecs_, offered_audio_codec, nullptr)) { filtered_offered_audio_codecs.push_back(offered_audio_codec); } } } else if (IsMediaContentOfType(&content, MEDIA_TYPE_VIDEO)) { const VideoContentDescription* video = content.media_description()->as_video(); for (const VideoCodec& offered_video_codec : video->codecs()) { if (!FindMatchingCodec<VideoCodec>(video->codecs(), filtered_offered_video_codecs, offered_video_codec, nullptr) && FindMatchingCodec<VideoCodec>(video->codecs(), video_codecs_, offered_video_codec, nullptr)) { filtered_offered_video_codecs.push_back(offered_video_codec); } } } else if (IsMediaContentOfType(&content, MEDIA_TYPE_DATA)) { const RtpDataContentDescription* data = content.media_description()->as_rtp_data(); if (data) { // RTP data. This part is inactive for SCTP data. for (const RtpDataCodec& offered_rtp_data_codec : data->codecs()) { if (!FindMatchingCodec<RtpDataCodec>( data->codecs(), filtered_offered_rtp_data_codecs, offered_rtp_data_codec, nullptr) && FindMatchingCodec<RtpDataCodec>(data->codecs(), rtp_data_codecs_, offered_rtp_data_codec, nullptr)) { filtered_offered_rtp_data_codecs.push_back(offered_rtp_data_codec); } } } } } // Add codecs that are not in the current description but were in // |remote_offer|. MergeCodecs<AudioCodec>(filtered_offered_audio_codecs, audio_codecs, &used_pltypes); MergeCodecs<VideoCodec>(filtered_offered_video_codecs, video_codecs, &used_pltypes); MergeCodecs<DataCodec>(filtered_offered_rtp_data_codecs, rtp_data_codecs, &used_pltypes); } void MediaSessionDescriptionFactory::GetRtpHdrExtsToOffer( const std::vector<const ContentInfo*>& current_active_contents, bool extmap_allow_mixed, RtpHeaderExtensions* offer_audio_extensions, RtpHeaderExtensions* offer_video_extensions) const { // All header extensions allocated from the same range to avoid potential // issues when using BUNDLE. // Strictly speaking the SDP attribute extmap_allow_mixed signals that the // receiver supports an RTP stream where one- and two-byte RTP header // extensions are mixed. For backwards compatibility reasons it's used in // WebRTC to signal that two-byte RTP header extensions are supported. UsedRtpHeaderExtensionIds used_ids( extmap_allow_mixed ? UsedRtpHeaderExtensionIds::IdDomain::kTwoByteAllowed : UsedRtpHeaderExtensionIds::IdDomain::kOneByteOnly); RtpHeaderExtensions all_regular_extensions; RtpHeaderExtensions all_encrypted_extensions; // First - get all extensions from the current description if the media type // is used. // Add them to |used_ids| so the local ids are not reused if a new media // type is added. for (const ContentInfo* content : current_active_contents) { if (IsMediaContentOfType(content, MEDIA_TYPE_AUDIO)) { const AudioContentDescription* audio = content->media_description()->as_audio(); MergeRtpHdrExts(audio->rtp_header_extensions(), offer_audio_extensions, &all_regular_extensions, &all_encrypted_extensions, &used_ids); } else if (IsMediaContentOfType(content, MEDIA_TYPE_VIDEO)) { const VideoContentDescription* video = content->media_description()->as_video(); MergeRtpHdrExts(video->rtp_header_extensions(), offer_video_extensions, &all_regular_extensions, &all_encrypted_extensions, &used_ids); } } // Add our default RTP header extensions that are not in the current // description. MergeRtpHdrExts(audio_rtp_header_extensions(), offer_audio_extensions, &all_regular_extensions, &all_encrypted_extensions, &used_ids); MergeRtpHdrExts(video_rtp_header_extensions(), offer_video_extensions, &all_regular_extensions, &all_encrypted_extensions, &used_ids); // TODO(jbauch): Support adding encrypted header extensions to existing // sessions. if (enable_encrypted_rtp_header_extensions_ && current_active_contents.empty()) { AddEncryptedVersionsOfHdrExts(offer_audio_extensions, &all_encrypted_extensions, &used_ids); AddEncryptedVersionsOfHdrExts(offer_video_extensions, &all_encrypted_extensions, &used_ids); } } bool MediaSessionDescriptionFactory::AddTransportOffer( const std::string& content_name, const TransportOptions& transport_options, const SessionDescription* current_desc, SessionDescription* offer_desc, IceCredentialsIterator* ice_credentials) const { if (!transport_desc_factory_) return false; const TransportDescription* current_tdesc = GetTransportDescription(content_name, current_desc); std::unique_ptr<TransportDescription> new_tdesc( transport_desc_factory_->CreateOffer(transport_options, current_tdesc, ice_credentials)); if (!new_tdesc) { RTC_LOG(LS_ERROR) << "Failed to AddTransportOffer, content name=" << content_name; } offer_desc->AddTransportInfo(TransportInfo(content_name, *new_tdesc)); return true; } std::unique_ptr<TransportDescription> MediaSessionDescriptionFactory::CreateTransportAnswer( const std::string& content_name, const SessionDescription* offer_desc, const TransportOptions& transport_options, const SessionDescription* current_desc, bool require_transport_attributes, IceCredentialsIterator* ice_credentials) const { if (!transport_desc_factory_) return NULL; const TransportDescription* offer_tdesc = GetTransportDescription(content_name, offer_desc); const TransportDescription* current_tdesc = GetTransportDescription(content_name, current_desc); return transport_desc_factory_->CreateAnswer(offer_tdesc, transport_options, require_transport_attributes, current_tdesc, ice_credentials); } bool MediaSessionDescriptionFactory::AddTransportAnswer( const std::string& content_name, const TransportDescription& transport_desc, SessionDescription* answer_desc) const { answer_desc->AddTransportInfo(TransportInfo(content_name, transport_desc)); return true; } // |audio_codecs| = set of all possible codecs that can be used, with correct // payload type mappings // // |supported_audio_codecs| = set of codecs that are supported for the direction // of this m= section // // acd->codecs() = set of previously negotiated codecs for this m= section // // The payload types should come from audio_codecs, but the order should come // from acd->codecs() and then supported_codecs, to ensure that re-offers don't // change existing codec priority, and that new codecs are added with the right // priority. bool MediaSessionDescriptionFactory::AddAudioContentForOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* current_content, const SessionDescription* current_description, const RtpHeaderExtensions& audio_rtp_extensions, const AudioCodecs& audio_codecs, StreamParamsVec* current_streams, SessionDescription* desc, IceCredentialsIterator* ice_credentials) const { // Filter audio_codecs (which includes all codecs, with correctly remapped // payload types) based on transceiver direction. const AudioCodecs& supported_audio_codecs = GetAudioCodecsForOffer(media_description_options.direction); AudioCodecs filtered_codecs; if (!media_description_options.codec_preferences.empty()) { // Add the codecs from the current transceiver's codec preferences. // They override any existing codecs from previous negotiations. filtered_codecs = MatchCodecPreference( media_description_options.codec_preferences, supported_audio_codecs); } else { // Add the codecs from current content if it exists and is not rejected nor // recycled. if (current_content && !current_content->rejected && current_content->name == media_description_options.mid) { RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO)); const AudioContentDescription* acd = current_content->media_description()->as_audio(); for (const AudioCodec& codec : acd->codecs()) { if (FindMatchingCodec<AudioCodec>(acd->codecs(), audio_codecs, codec, nullptr)) { filtered_codecs.push_back(codec); } } } // Add other supported audio codecs. AudioCodec found_codec; for (const AudioCodec& codec : supported_audio_codecs) { if (FindMatchingCodec<AudioCodec>(supported_audio_codecs, audio_codecs, codec, &found_codec) && !FindMatchingCodec<AudioCodec>(supported_audio_codecs, filtered_codecs, codec, nullptr)) { // Use the |found_codec| from |audio_codecs| because it has the // correctly mapped payload type. filtered_codecs.push_back(found_codec); } } } cricket::SecurePolicy sdes_policy = IsDtlsActive(current_content, current_description) ? cricket::SEC_DISABLED : secure(); std::unique_ptr<AudioContentDescription> audio(new AudioContentDescription()); std::vector<std::string> crypto_suites; GetSupportedAudioSdesCryptoSuiteNames(session_options.crypto_options, &crypto_suites); if (!CreateMediaContentOffer(media_description_options, session_options, filtered_codecs, sdes_policy, GetCryptos(current_content), crypto_suites, audio_rtp_extensions, ssrc_generator_, current_streams, audio.get())) { return false; } bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); SetMediaProtocol(secure_transport, audio.get()); audio->set_direction(media_description_options.direction); desc->AddContent(media_description_options.mid, MediaProtocolType::kRtp, media_description_options.stopped, std::move(audio)); if (!AddTransportOffer(media_description_options.mid, media_description_options.transport_options, current_description, desc, ice_credentials)) { return false; } return true; } bool MediaSessionDescriptionFactory::AddVideoContentForOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* current_content, const SessionDescription* current_description, const RtpHeaderExtensions& video_rtp_extensions, const VideoCodecs& video_codecs, StreamParamsVec* current_streams, SessionDescription* desc, IceCredentialsIterator* ice_credentials) const { cricket::SecurePolicy sdes_policy = IsDtlsActive(current_content, current_description) ? cricket::SEC_DISABLED : secure(); std::unique_ptr<VideoContentDescription> video(new VideoContentDescription()); std::vector<std::string> crypto_suites; GetSupportedVideoSdesCryptoSuiteNames(session_options.crypto_options, &crypto_suites); VideoCodecs filtered_codecs; if (!media_description_options.codec_preferences.empty()) { // Add the codecs from the current transceiver's codec preferences. // They override any existing codecs from previous negotiations. filtered_codecs = MatchCodecPreference( media_description_options.codec_preferences, video_codecs_); } else { // Add the codecs from current content if it exists and is not rejected nor // recycled. if (current_content && !current_content->rejected && current_content->name == media_description_options.mid) { RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO)); const VideoContentDescription* vcd = current_content->media_description()->as_video(); for (const VideoCodec& codec : vcd->codecs()) { if (FindMatchingCodec<VideoCodec>(vcd->codecs(), video_codecs, codec, nullptr)) { filtered_codecs.push_back(codec); } } } // Add other supported video codecs. VideoCodec found_codec; for (const VideoCodec& codec : video_codecs_) { if (FindMatchingCodec<VideoCodec>(video_codecs_, video_codecs, codec, &found_codec) && !FindMatchingCodec<VideoCodec>(video_codecs_, filtered_codecs, codec, nullptr)) { // Use the |found_codec| from |video_codecs| because it has the // correctly mapped payload type. filtered_codecs.push_back(found_codec); } } } if (session_options.raw_packetization_for_video) { for (VideoCodec& codec : filtered_codecs) { if (codec.GetCodecType() == VideoCodec::CODEC_VIDEO) { codec.packetization = kPacketizationParamRaw; } } } if (!CreateMediaContentOffer(media_description_options, session_options, filtered_codecs, sdes_policy, GetCryptos(current_content), crypto_suites, video_rtp_extensions, ssrc_generator_, current_streams, video.get())) { return false; } video->set_bandwidth(kAutoBandwidth); bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); SetMediaProtocol(secure_transport, video.get()); video->set_direction(media_description_options.direction); desc->AddContent(media_description_options.mid, MediaProtocolType::kRtp, media_description_options.stopped, std::move(video)); if (!AddTransportOffer(media_description_options.mid, media_description_options.transport_options, current_description, desc, ice_credentials)) { return false; } return true; } bool MediaSessionDescriptionFactory::AddSctpDataContentForOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* current_content, const SessionDescription* current_description, StreamParamsVec* current_streams, SessionDescription* desc, IceCredentialsIterator* ice_credentials) const { std::unique_ptr<SctpDataContentDescription> data( new SctpDataContentDescription()); bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); cricket::SecurePolicy sdes_policy = IsDtlsActive(current_content, current_description) ? cricket::SEC_DISABLED : secure(); std::vector<std::string> crypto_suites; // SDES doesn't make sense for SCTP, so we disable it, and we only // get SDES crypto suites for RTP-based data channels. sdes_policy = cricket::SEC_DISABLED; // Unlike SetMediaProtocol below, we need to set the protocol // before we call CreateMediaContentOffer. Otherwise, // CreateMediaContentOffer won't know this is SCTP and will // generate SSRCs rather than SIDs. data->set_protocol(secure_transport ? kMediaProtocolUdpDtlsSctp : kMediaProtocolSctp); data->set_use_sctpmap(session_options.use_obsolete_sctp_sdp); data->set_max_message_size(kSctpSendBufferSize); if (!CreateContentOffer(media_description_options, session_options, sdes_policy, GetCryptos(current_content), crypto_suites, RtpHeaderExtensions(), ssrc_generator_, current_streams, data.get())) { return false; } desc->AddContent(media_description_options.mid, MediaProtocolType::kSctp, std::move(data)); if (!AddTransportOffer(media_description_options.mid, media_description_options.transport_options, current_description, desc, ice_credentials)) { return false; } return true; } bool MediaSessionDescriptionFactory::AddRtpDataContentForOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* current_content, const SessionDescription* current_description, const RtpDataCodecs& rtp_data_codecs, StreamParamsVec* current_streams, SessionDescription* desc, IceCredentialsIterator* ice_credentials) const { std::unique_ptr<RtpDataContentDescription> data( new RtpDataContentDescription()); bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED); cricket::SecurePolicy sdes_policy = IsDtlsActive(current_content, current_description) ? cricket::SEC_DISABLED : secure(); std::vector<std::string> crypto_suites; GetSupportedDataSdesCryptoSuiteNames(session_options.crypto_options, &crypto_suites); if (!CreateMediaContentOffer(media_description_options, session_options, rtp_data_codecs, sdes_policy, GetCryptos(current_content), crypto_suites, RtpHeaderExtensions(), ssrc_generator_, current_streams, data.get())) { return false; } data->set_bandwidth(kDataMaxBandwidth); SetMediaProtocol(secure_transport, data.get()); desc->AddContent(media_description_options.mid, MediaProtocolType::kRtp, media_description_options.stopped, std::move(data)); if (!AddTransportOffer(media_description_options.mid, media_description_options.transport_options, current_description, desc, ice_credentials)) { return false; } return true; } bool MediaSessionDescriptionFactory::AddDataContentForOffer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* current_content, const SessionDescription* current_description, const RtpDataCodecs& rtp_data_codecs, StreamParamsVec* current_streams, SessionDescription* desc, IceCredentialsIterator* ice_credentials) const { bool is_sctp = (session_options.data_channel_type == DCT_SCTP || session_options.data_channel_type == DCT_DATA_CHANNEL_TRANSPORT_SCTP); // If the DataChannel type is not specified, use the DataChannel type in // the current description. if (session_options.data_channel_type == DCT_NONE && current_content) { RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_DATA)); is_sctp = (current_content->media_description()->protocol() == kMediaProtocolSctp); } if (is_sctp) { return AddSctpDataContentForOffer( media_description_options, session_options, current_content, current_description, current_streams, desc, ice_credentials); } else { return AddRtpDataContentForOffer(media_description_options, session_options, current_content, current_description, rtp_data_codecs, current_streams, desc, ice_credentials); } } // |audio_codecs| = set of all possible codecs that can be used, with correct // payload type mappings // // |supported_audio_codecs| = set of codecs that are supported for the direction // of this m= section // // acd->codecs() = set of previously negotiated codecs for this m= section // // The payload types should come from audio_codecs, but the order should come // from acd->codecs() and then supported_codecs, to ensure that re-offers don't // change existing codec priority, and that new codecs are added with the right // priority. bool MediaSessionDescriptionFactory::AddAudioContentForAnswer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* offer_content, const SessionDescription* offer_description, const ContentInfo* current_content, const SessionDescription* current_description, const TransportInfo* bundle_transport, const AudioCodecs& audio_codecs, StreamParamsVec* current_streams, SessionDescription* answer, IceCredentialsIterator* ice_credentials) const { RTC_CHECK(IsMediaContentOfType(offer_content, MEDIA_TYPE_AUDIO)); const AudioContentDescription* offer_audio_description = offer_content->media_description()->as_audio(); std::unique_ptr<TransportDescription> audio_transport = CreateTransportAnswer( media_description_options.mid, offer_description, media_description_options.transport_options, current_description, bundle_transport != nullptr, ice_credentials); if (!audio_transport) { return false; } // Pick codecs based on the requested communications direction in the offer // and the selected direction in the answer. // Note these will be filtered one final time in CreateMediaContentAnswer. auto wants_rtd = media_description_options.direction; auto offer_rtd = offer_audio_description->direction(); auto answer_rtd = NegotiateRtpTransceiverDirection(offer_rtd, wants_rtd); AudioCodecs supported_audio_codecs = GetAudioCodecsForAnswer(offer_rtd, answer_rtd); AudioCodecs filtered_codecs; if (!media_description_options.codec_preferences.empty()) { filtered_codecs = MatchCodecPreference( media_description_options.codec_preferences, supported_audio_codecs); } else { // Add the codecs from current content if it exists and is not rejected nor // recycled. if (current_content && !current_content->rejected && current_content->name == media_description_options.mid) { RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO)); const AudioContentDescription* acd = current_content->media_description()->as_audio(); for (const AudioCodec& codec : acd->codecs()) { if (FindMatchingCodec<AudioCodec>(acd->codecs(), audio_codecs, codec, nullptr)) { filtered_codecs.push_back(codec); } } } // Add other supported audio codecs. for (const AudioCodec& codec : supported_audio_codecs) { if (FindMatchingCodec<AudioCodec>(supported_audio_codecs, audio_codecs, codec, nullptr) && !FindMatchingCodec<AudioCodec>(supported_audio_codecs, filtered_codecs, codec, nullptr)) { // We should use the local codec with local parameters and the codec id // would be correctly mapped in |NegotiateCodecs|. filtered_codecs.push_back(codec); } } } bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) && session_options.bundle_enabled; std::unique_ptr<AudioContentDescription> audio_answer( new AudioContentDescription()); // Do not require or create SDES cryptos if DTLS is used. cricket::SecurePolicy sdes_policy = audio_transport->secure() ? cricket::SEC_DISABLED : secure(); if (!SetCodecsInAnswer(offer_audio_description, filtered_codecs, media_description_options, session_options, ssrc_generator_, current_streams, audio_answer.get())) { return false; } if (!CreateMediaContentAnswer( offer_audio_description, media_description_options, session_options, sdes_policy, GetCryptos(current_content), audio_rtp_header_extensions(), ssrc_generator_, enable_encrypted_rtp_header_extensions_, current_streams, bundle_enabled, audio_answer.get())) { return false; // Fails the session setup. } bool secure = bundle_transport ? bundle_transport->description.secure() : audio_transport->secure(); bool rejected = media_description_options.stopped || offer_content->rejected || !IsMediaProtocolSupported(MEDIA_TYPE_AUDIO, audio_answer->protocol(), secure); if (!AddTransportAnswer(media_description_options.mid, *(audio_transport.get()), answer)) { return false; } if (rejected) { RTC_LOG(LS_INFO) << "Audio m= section '" << media_description_options.mid << "' being rejected in answer."; } answer->AddContent(media_description_options.mid, offer_content->type, rejected, std::move(audio_answer)); return true; } bool MediaSessionDescriptionFactory::AddVideoContentForAnswer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* offer_content, const SessionDescription* offer_description, const ContentInfo* current_content, const SessionDescription* current_description, const TransportInfo* bundle_transport, const VideoCodecs& video_codecs, StreamParamsVec* current_streams, SessionDescription* answer, IceCredentialsIterator* ice_credentials) const { RTC_CHECK(IsMediaContentOfType(offer_content, MEDIA_TYPE_VIDEO)); const VideoContentDescription* offer_video_description = offer_content->media_description()->as_video(); std::unique_ptr<TransportDescription> video_transport = CreateTransportAnswer( media_description_options.mid, offer_description, media_description_options.transport_options, current_description, bundle_transport != nullptr, ice_credentials); if (!video_transport) { return false; } VideoCodecs filtered_codecs; if (!media_description_options.codec_preferences.empty()) { filtered_codecs = MatchCodecPreference( media_description_options.codec_preferences, video_codecs_); } else { // Add the codecs from current content if it exists and is not rejected nor // recycled. if (current_content && !current_content->rejected && current_content->name == media_description_options.mid) { RTC_CHECK(IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO)); const VideoContentDescription* vcd = current_content->media_description()->as_video(); for (const VideoCodec& codec : vcd->codecs()) { if (FindMatchingCodec<VideoCodec>(vcd->codecs(), video_codecs, codec, nullptr)) { filtered_codecs.push_back(codec); } } } // Add other supported video codecs. for (const VideoCodec& codec : video_codecs_) { if (FindMatchingCodec<VideoCodec>(video_codecs_, video_codecs, codec, nullptr) && !FindMatchingCodec<VideoCodec>(video_codecs_, filtered_codecs, codec, nullptr)) { // We should use the local codec with local parameters and the codec id // would be correctly mapped in |NegotiateCodecs|. filtered_codecs.push_back(codec); } } } if (session_options.raw_packetization_for_video) { for (VideoCodec& codec : filtered_codecs) { if (codec.GetCodecType() == VideoCodec::CODEC_VIDEO) { codec.packetization = kPacketizationParamRaw; } } } bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) && session_options.bundle_enabled; std::unique_ptr<VideoContentDescription> video_answer( new VideoContentDescription()); // Do not require or create SDES cryptos if DTLS is used. cricket::SecurePolicy sdes_policy = video_transport->secure() ? cricket::SEC_DISABLED : secure(); if (!SetCodecsInAnswer(offer_video_description, filtered_codecs, media_description_options, session_options, ssrc_generator_, current_streams, video_answer.get())) { return false; } if (!CreateMediaContentAnswer( offer_video_description, media_description_options, session_options, sdes_policy, GetCryptos(current_content), video_rtp_header_extensions(), ssrc_generator_, enable_encrypted_rtp_header_extensions_, current_streams, bundle_enabled, video_answer.get())) { return false; // Failed the sessin setup. } bool secure = bundle_transport ? bundle_transport->description.secure() : video_transport->secure(); bool rejected = media_description_options.stopped || offer_content->rejected || !IsMediaProtocolSupported(MEDIA_TYPE_VIDEO, video_answer->protocol(), secure); if (!AddTransportAnswer(media_description_options.mid, *(video_transport.get()), answer)) { return false; } if (!rejected) { video_answer->set_bandwidth(kAutoBandwidth); } else { RTC_LOG(LS_INFO) << "Video m= section '" << media_description_options.mid << "' being rejected in answer."; } answer->AddContent(media_description_options.mid, offer_content->type, rejected, std::move(video_answer)); return true; } bool MediaSessionDescriptionFactory::AddDataContentForAnswer( const MediaDescriptionOptions& media_description_options, const MediaSessionOptions& session_options, const ContentInfo* offer_content, const SessionDescription* offer_description, const ContentInfo* current_content, const SessionDescription* current_description, const TransportInfo* bundle_transport, const RtpDataCodecs& rtp_data_codecs, StreamParamsVec* current_streams, SessionDescription* answer, IceCredentialsIterator* ice_credentials) const { std::unique_ptr<TransportDescription> data_transport = CreateTransportAnswer( media_description_options.mid, offer_description, media_description_options.transport_options, current_description, bundle_transport != nullptr, ice_credentials); if (!data_transport) { return false; } // Do not require or create SDES cryptos if DTLS is used. cricket::SecurePolicy sdes_policy = data_transport->secure() ? cricket::SEC_DISABLED : secure(); bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) && session_options.bundle_enabled; RTC_CHECK(IsMediaContentOfType(offer_content, MEDIA_TYPE_DATA)); std::unique_ptr<MediaContentDescription> data_answer; if (offer_content->media_description()->as_sctp()) { // SCTP data content data_answer = std::make_unique<SctpDataContentDescription>(); const SctpDataContentDescription* offer_data_description = offer_content->media_description()->as_sctp(); // Respond with the offerer's proto, whatever it is. data_answer->as_sctp()->set_protocol(offer_data_description->protocol()); // Respond with our max message size or the remote max messsage size, // whichever is smaller. // 0 is treated specially - it means "I can accept any size". Since // we do not implement infinite size messages, reply with // kSctpSendBufferSize. if (offer_data_description->max_message_size() == 0) { data_answer->as_sctp()->set_max_message_size(kSctpSendBufferSize); } else { data_answer->as_sctp()->set_max_message_size(std::min( offer_data_description->max_message_size(), kSctpSendBufferSize)); } if (!CreateMediaContentAnswer( offer_data_description, media_description_options, session_options, sdes_policy, GetCryptos(current_content), RtpHeaderExtensions(), ssrc_generator_, enable_encrypted_rtp_header_extensions_, current_streams, bundle_enabled, data_answer.get())) { return false; // Fails the session setup. } // Respond with sctpmap if the offer uses sctpmap. bool offer_uses_sctpmap = offer_data_description->use_sctpmap(); data_answer->as_sctp()->set_use_sctpmap(offer_uses_sctpmap); } else { // RTP offer data_answer = std::make_unique<RtpDataContentDescription>(); const RtpDataContentDescription* offer_data_description = offer_content->media_description()->as_rtp_data(); RTC_CHECK(offer_data_description); if (!SetCodecsInAnswer(offer_data_description, rtp_data_codecs, media_description_options, session_options, ssrc_generator_, current_streams, data_answer->as_rtp_data())) { return false; } if (!CreateMediaContentAnswer( offer_data_description, media_description_options, session_options, sdes_policy, GetCryptos(current_content), RtpHeaderExtensions(), ssrc_generator_, enable_encrypted_rtp_header_extensions_, current_streams, bundle_enabled, data_answer.get())) { return false; // Fails the session setup. } } bool secure = bundle_transport ? bundle_transport->description.secure() : data_transport->secure(); bool rejected = session_options.data_channel_type == DCT_NONE || media_description_options.stopped || offer_content->rejected || !IsMediaProtocolSupported(MEDIA_TYPE_DATA, data_answer->protocol(), secure); if (!AddTransportAnswer(media_description_options.mid, *(data_transport.get()), answer)) { return false; } if (!rejected) { data_answer->set_bandwidth(kDataMaxBandwidth); } else { // RFC 3264 // The answer MUST contain the same number of m-lines as the offer. RTC_LOG(LS_INFO) << "Data is not supported in the answer."; } answer->AddContent(media_description_options.mid, offer_content->type, rejected, std::move(data_answer)); return true; } void MediaSessionDescriptionFactory::ComputeAudioCodecsIntersectionAndUnion() { audio_sendrecv_codecs_.clear(); all_audio_codecs_.clear(); // Compute the audio codecs union. for (const AudioCodec& send : audio_send_codecs_) { all_audio_codecs_.push_back(send); if (!FindMatchingCodec<AudioCodec>(audio_send_codecs_, audio_recv_codecs_, send, nullptr)) { // It doesn't make sense to have an RTX codec we support sending but not // receiving. RTC_DCHECK(!IsRtxCodec(send)); } } for (const AudioCodec& recv : audio_recv_codecs_) { if (!FindMatchingCodec<AudioCodec>(audio_recv_codecs_, audio_send_codecs_, recv, nullptr)) { all_audio_codecs_.push_back(recv); } } // Use NegotiateCodecs to merge our codec lists, since the operation is // essentially the same. Put send_codecs as the offered_codecs, which is the // order we'd like to follow. The reasoning is that encoding is usually more // expensive than decoding, and prioritizing a codec in the send list probably // means it's a codec we can handle efficiently. NegotiateCodecs(audio_recv_codecs_, audio_send_codecs_, &audio_sendrecv_codecs_, true); } bool IsMediaContent(const ContentInfo* content) { return (content && (content->type == MediaProtocolType::kRtp || content->type == MediaProtocolType::kSctp)); } bool IsAudioContent(const ContentInfo* content) { return IsMediaContentOfType(content, MEDIA_TYPE_AUDIO); } bool IsVideoContent(const ContentInfo* content) { return IsMediaContentOfType(content, MEDIA_TYPE_VIDEO); } bool IsDataContent(const ContentInfo* content) { return IsMediaContentOfType(content, MEDIA_TYPE_DATA); } const ContentInfo* GetFirstMediaContent(const ContentInfos& contents, MediaType media_type) { for (const ContentInfo& content : contents) { if (IsMediaContentOfType(&content, media_type)) { return &content; } } return nullptr; } const ContentInfo* GetFirstAudioContent(const ContentInfos& contents) { return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO); } const ContentInfo* GetFirstVideoContent(const ContentInfos& contents) { return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO); } const ContentInfo* GetFirstDataContent(const ContentInfos& contents) { return GetFirstMediaContent(contents, MEDIA_TYPE_DATA); } const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc, MediaType media_type) { if (sdesc == nullptr) { return nullptr; } return GetFirstMediaContent(sdesc->contents(), media_type); } const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc) { return GetFirstMediaContent(sdesc, MEDIA_TYPE_AUDIO); } const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc) { return GetFirstMediaContent(sdesc, MEDIA_TYPE_VIDEO); } const ContentInfo* GetFirstDataContent(const SessionDescription* sdesc) { return GetFirstMediaContent(sdesc, MEDIA_TYPE_DATA); } const MediaContentDescription* GetFirstMediaContentDescription( const SessionDescription* sdesc, MediaType media_type) { const ContentInfo* content = GetFirstMediaContent(sdesc, media_type); return (content ? content->media_description() : nullptr); } const AudioContentDescription* GetFirstAudioContentDescription( const SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_AUDIO); return desc ? desc->as_audio() : nullptr; } const VideoContentDescription* GetFirstVideoContentDescription( const SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO); return desc ? desc->as_video() : nullptr; } const RtpDataContentDescription* GetFirstRtpDataContentDescription( const SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA); return desc ? desc->as_rtp_data() : nullptr; } const SctpDataContentDescription* GetFirstSctpDataContentDescription( const SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA); return desc ? desc->as_sctp() : nullptr; } // // Non-const versions of the above functions. // ContentInfo* GetFirstMediaContent(ContentInfos* contents, MediaType media_type) { for (ContentInfo& content : *contents) { if (IsMediaContentOfType(&content, media_type)) { return &content; } } return nullptr; } ContentInfo* GetFirstAudioContent(ContentInfos* contents) { return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO); } ContentInfo* GetFirstVideoContent(ContentInfos* contents) { return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO); } ContentInfo* GetFirstDataContent(ContentInfos* contents) { return GetFirstMediaContent(contents, MEDIA_TYPE_DATA); } ContentInfo* GetFirstMediaContent(SessionDescription* sdesc, MediaType media_type) { if (sdesc == nullptr) { return nullptr; } return GetFirstMediaContent(&sdesc->contents(), media_type); } ContentInfo* GetFirstAudioContent(SessionDescription* sdesc) { return GetFirstMediaContent(sdesc, MEDIA_TYPE_AUDIO); } ContentInfo* GetFirstVideoContent(SessionDescription* sdesc) { return GetFirstMediaContent(sdesc, MEDIA_TYPE_VIDEO); } ContentInfo* GetFirstDataContent(SessionDescription* sdesc) { return GetFirstMediaContent(sdesc, MEDIA_TYPE_DATA); } MediaContentDescription* GetFirstMediaContentDescription( SessionDescription* sdesc, MediaType media_type) { ContentInfo* content = GetFirstMediaContent(sdesc, media_type); return (content ? content->media_description() : nullptr); } AudioContentDescription* GetFirstAudioContentDescription( SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_AUDIO); return desc ? desc->as_audio() : nullptr; } VideoContentDescription* GetFirstVideoContentDescription( SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO); return desc ? desc->as_video() : nullptr; } RtpDataContentDescription* GetFirstRtpDataContentDescription( SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA); return desc ? desc->as_rtp_data() : nullptr; } SctpDataContentDescription* GetFirstSctpDataContentDescription( SessionDescription* sdesc) { auto desc = GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA); return desc ? desc->as_sctp() : nullptr; } } // namespace cricket
; unsigned char esx_m_setdrv(unsigned char drive) SECTION code_esxdos PUBLIC _esx_m_setdrv EXTERN asm_esx_m_setdrv _esx_m_setdrv: pop af pop hl push hl push af jp asm_esx_m_setdrv
; Load font.chr asset to _VRAM -> _VRAM + $7F. ; ; Destroys registers `af`, `bc`, `de`, `hl` LoadFont: ld hl, _VRAM ld de, FontTiles ld bc, FontTilesEnd - FontTiles .while ld a, b or c and a jp z, .end .do ld a, [de] inc de ld [hl], a inc hl dec bc jp .while .end ret
//============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NT2_COMBINATORIAL_FUNCTIONS_LCM_HPP_INCLUDED #define NT2_COMBINATORIAL_FUNCTIONS_LCM_HPP_INCLUDED #include <nt2/include/functor.hpp> namespace nt2 { namespace tag { /*! @brief lcm generic tag Represents the lcm function in generic contexts. @par Models: Hierarchy **/ struct lcm_ : ext::elementwise_<lcm_> { /// @brief Parent hierarchy typedef ext::elementwise_<lcm_> parent; template<class... Args> static BOOST_FORCEINLINE BOOST_AUTO_DECLTYPE dispatch(Args&&... args) BOOST_AUTO_DECLTYPE_BODY( dispatching_lcm_( ext::adl_helper(), static_cast<Args&&>(args)... ) ) }; } namespace ext { template<class Site, class... Ts> BOOST_FORCEINLINE generic_dispatcher<tag::lcm_, Site> dispatching_lcm_(adl_helper, boost::dispatch::meta::unknown_<Site>, boost::dispatch::meta::unknown_<Ts>...) { return generic_dispatcher<tag::lcm_, Site>(); } template<class... Args> struct impl_lcm_; } /*! Computes the least common multiple If parameters are floating point and not flint, nan is returned. @par Semantic: For every table expressions @code auto r = lcm(a0,a1); @endcode - If any input is zero 0 is returned - If parameters are floating point and not flint, nan is returned. @see @funcref{gcd}, @funcref{is_flint} @param a0 @param a1 @return an expression which eventually will evaluate to the result **/ NT2_FUNCTION_IMPLEMENTATION(tag::lcm_, lcm, 2) } #endif
%include "macros/patch.inc" %include "macros/datatypes.inc" %include "TiberianSun.inc" sstring str_SoundsMIX, "SOUNDS.MIX" sstring str_TOLong, "Tiberian Odyssey" sstring str_DTAGameWindow, "TO (Game Window)" sstring str_LanguageDLLNotFound, "Language.dll not found, please start TO.exe and click Save in the Options menu." sstring str_SoundsINI, "SOUND.INI" sstring str_CacheMIX, "CACHE.MIX" sstring str_Sounds01MIX, "SOUNDS01.MIX" sstring str_SideMIX, "SIDE%02d.MIX" sstring str_SideCDMIX, "SIDECD%02d.MIX" sstring str_MenuINI, "MENU.INI" sstring str_BriefingPCX, "BRIEFING.PCX" sstring str_BattleEINI, "BATTLEE.INI" sstring str_SidencMIX, "SIDENC%02d.MIX" sstring str_SideMIXRoot, "SIDE%02dE.MIX" sstring str_MPMapsINI, "MPMAPS.INI" sstring str_MoviesMIX, "MOVIES%02d.MIX" sstring str_DTAAlreadyRunning, "TO is already running!" sstring str_D1, "D1" sstring str_D2, "D2" sstring str_DTA, "TO" sstring str_Red, "Red" sstring str_DarkRed, "DarkRed" ; String references @SET 0x0044EBF3, push str_SoundsMIX @SET 0x00472567, push str_TOLong @SET 0x0047256C, push str_LanguageDLLNotFound @SET 0x004E0912, push str_SoundsINI @SET 0x004E0919, push str_SoundsINI @SET 0x004E4078, push str_CacheMIX @SET 0x004E430F, push str_SoundsMIX ; Sounds01.MIX? @SET 0x004E4360, push str_SoundsMIX ; Sounds01.MIX? @SET 0x004E439C, push str_SoundsMIX @SET 0x004E43ED, push str_SoundsMIX @SET 0x004E80D8, push str_SideMIX @SET 0x004E838C, push esi @SET 0x005801BB, push str_MenuINI ;@SET 0x005C04AF, {mov ecx, str_BriefingPCX} @SET 0x005FF2C0, {cmp edx, str_TOLong} @SET 0x005FF2C8, push str_TOLong @SET 0x005FF2D9, push str_TOLong @SET 0x005FF3AA, {cmp ecx, str_TOLong} @SET 0x005FF3B2, push str_TOLong @SET 0x005FF3C3, push str_TOLong @SET 0x005FF4EC, push str_TOLong @SET 0x005EE8B0, push str_MPMapsINI @SET 0x005EEB82, push str_MPMapsINI @SET 0x0044ECC5, push str_MoviesMIX @SET 0x004E4543, push str_MoviesMIX @SET 0x006861ED, {mov dword [esp+48h], str_TOLong} ; dword ptr @SET 0x00686215, push str_TOLong @SET 0x0068621A, push str_TOLong @SET 0x006862BD, push str_TOLong @SET 0x006862C2, push str_TOLong @SET 0x006CA940, {db "TEM",0,0,0} @SET 0x006CA954, {db "TEM",0} @SET 0x006CA968, {db "SNO", 0,0,0} @SET 0x006CA97C, {db "SNO", 0} @SET 0x006F99D8, {db "TOCREDIT.txt"} ; Erase NAWALL and GAWALL @SET 0x00710DA4, {db 0,0,0,0,0,0} @SET 0x00710DAC, {db 0,0,0,0,0,0} ; ;; Trackbar Border Color change @SET 0x0059138B, {db 0x09, 0x92, 0x0F} ; Selected list-box item background color @SET 0x00591395, {db 0x00, 0x7D, 0x00} ; ; ; Disable check for MoviesXX.mix, forces function to return al=1 @SET 0x004E45D8, {mov al, 1} @SET 0x004E45DA, nop ; Included in no_movie_and_score_mix_dependency.asm ; Disable check for MULTI.MIX, force function to return al=1 @SJMP 0x004E42EE, 0x004E42FD ; jmp short loc_4E42FD ; Remove framework mode mmt/mms loading @LJMP 0x004F5182, 0x004F528C ; jmp loc_4F528C ; ; TechLevel slider limit @SET 0x0055AF05, push 70001h @SET 0x0055E110, push 70001h ;; "Some change in code calling to SendDlgItemMessageA" - techlevel slider limit?? @SET 0x0057C932, push 70001h ; ; ;; Sidebar text off by default @SET 0x00589972, {mov [eax+19h], cl} @SET 0x00589975, {mov [eax+1Ah], cl} ; ;; IsScoreShuffle on by default @SET 0x005899F1, {mov byte [eax+35h], 1} ;byte ptr @SET 0x005899F5, nop @SET 0x005899F6, nop @SET 0x005899F7, nop ; ;; Disable dialog "slide-open" sound effect @SJMP 0x00593DBF, 0x00593DF9 ; jmp short loc_593DF9 ; ;; Remove glowing edges from dialogs @SET 0x0059D410, retn 0Ch ;; Skip useless debug logging code ; *******BREAKS THE SPAWNER ;; @SET 0x005FF81C, jmp 0x005FFC41 ; "Overlay tiberium fix thing, 4th etc" @SET 0x00644DF9, {mov dword [esi+0ACh], 0Ch} ;dword ptr ; ;;; "Facings stuff" ;@SET 0x006530EB, {cmp dword [eax+4CCh], 20h} ;dword ptr ;@SET 0x00653106, {shr ebx, 0Ah} ;@SET 0x0065310D, {and ebx, 1Fh} ;; IsCoreDefender selection box size @SET 0x0065BD7E, {mov edx, 200h} @SET 0x0065BD94, {mov dword [edi+8], 64h} ;dword ptr @SET 0x0065BD9B, nop @SET 0x0065BD9C, nop ; ;; Rules.ini key, WalkFrames= default value @SET 0x0065B9E6, {mov byte [esi+4D0h], 1} ;byte ptr @SET 0x0065BF3D, {mov [esi+21h], eax} ; Set global variable byte containing side ID to load files for @SET 0x004E2CFA, {mov byte [0x7E2500], al} @SET 0x004E2CFF, nop @SET 0x004E2D00, {add esp, 4} @SJMP 0x004E2D03, 0x004E2D13 ; jmp short @SET 0x004E2D05, nop ; Load sidebar MIX files for new sides properly (for saved games) @SET 0x005D6C4F, {mov cl, [eax+1D91h]} @CLEAR 0x005D6C55, 0x90, 0x005D6C58 ; Load speech MIX files for new sides properly (for saved games) @SJMP 0x005D6DB8, 0x005D6DCE ;jmp short @SET 0x005D6DCE, {xor ecx, ecx} @SET 0x005D6DD0, {mov cl, [eax+1D91h]} @CLEAR 0x005D6DD6, 0x90, 0x005D6DDB ; Load sidebar MIX files for new sides properly @SET 0x005DD798, {mov cl, byte [0x007E2500]} @CLEAR 0x005DD79E, 0x90, 0x005DD7A2 ; Load speech MIX files for new sides properly @SET 0x005DD822, {xor ecx, ecx} @CLEAR 0x005DD822, 0x90, 0x005DD828 @SET 0x005DD82B, {mov cl, byte [0x007E2500]} ; Compile warning: byte value exceeds bounds? ; AI starting units will start in Unload mode instead of Area Guard mode (was 05 for Guard mode) @SET 0x005DEE36, push 0Fh ; Prevent more than 75 cameos from appearing in a sidebar column and thus crashing the game ;; @SJGE 0x005F463B, 0x005F46A1 ;jge short loc_5F46A1
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r14 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0xe3c3, %r13 nop nop nop nop lfence mov $0x6162636465666768, %r14 movq %r14, (%r13) nop nop sub %r10, %r10 lea addresses_normal_ht+0x3ecc, %r13 nop nop nop xor $15397, %rbx mov $0x6162636465666768, %r11 movq %r11, %xmm5 movups %xmm5, (%r13) nop nop nop xor $49127, %r11 lea addresses_normal_ht+0x19aa3, %rsi lea addresses_D_ht+0x1c7a3, %rdi nop nop nop sub %rbp, %rbp mov $35, %rcx rep movsq nop add %r11, %r11 lea addresses_WC_ht+0x7375, %r11 nop nop nop sub $64576, %rbp mov (%r11), %r14d nop nop nop nop nop xor %rbp, %rbp lea addresses_D_ht+0xd3a3, %r11 xor %rbp, %rbp movups (%r11), %xmm4 vpextrq $0, %xmm4, %rdi and %rdi, %rdi lea addresses_A_ht+0x1eba3, %rsi nop xor %rbp, %rbp mov $0x6162636465666768, %r10 movq %r10, (%rsi) nop nop nop nop sub $9698, %rbx lea addresses_UC_ht+0x1416f, %r11 nop nop nop nop sub %rcx, %rcx movl $0x61626364, (%r11) nop nop add %rsi, %rsi lea addresses_UC_ht+0x15a3, %rcx nop nop nop cmp $33580, %r10 movb (%rcx), %r14b nop nop nop add %rbp, %rbp lea addresses_normal_ht+0x19fa3, %rsi lea addresses_UC_ht+0x18fa3, %rdi cmp $186, %r11 mov $38, %rcx rep movsl nop nop nop add %rcx, %rcx lea addresses_A_ht+0x182e3, %rsi lea addresses_WT_ht+0x9dbb, %rdi nop cmp $26722, %rbp mov $26, %rcx rep movsb nop nop nop nop inc %rsi pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r14 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %rbp push %rdi push %rdx // Store lea addresses_WT+0x1a523, %r11 nop nop nop nop cmp $24770, %r10 mov $0x5152535455565758, %rdx movq %rdx, (%r11) nop nop nop nop cmp $10243, %rdx // Store lea addresses_WC+0x16da3, %rdi nop and %rbp, %rbp movw $0x5152, (%rdi) nop nop nop nop nop inc %r10 // Store lea addresses_PSE+0x117a3, %rdx nop nop nop sub $30244, %r11 movw $0x5152, (%rdx) nop nop nop sub %rdi, %rdi // Store lea addresses_normal+0x29a3, %r11 nop nop dec %r13 movl $0x51525354, (%r11) nop nop nop nop nop dec %rdi // Store mov $0x68ce8c0000000ba3, %r13 nop nop nop nop nop sub %rbp, %rbp movb $0x51, (%r13) nop nop xor $35203, %r10 // Store lea addresses_PSE+0x111c3, %rdx nop nop nop nop cmp %r11, %r11 movb $0x51, (%rdx) nop nop cmp %rdi, %rdi // Load mov $0x68ce8c0000000ba3, %rdx nop nop nop nop nop and %r15, %r15 mov (%rdx), %r10w cmp $4778, %r10 // Store mov $0x4264360000000aa3, %r15 nop nop nop nop nop inc %r11 mov $0x5152535455565758, %rdx movq %rdx, %xmm1 vmovups %ymm1, (%r15) nop nop nop nop nop add %rbp, %rbp // Store lea addresses_PSE+0x195a3, %r13 nop nop nop nop nop cmp $6933, %rdi mov $0x5152535455565758, %rbp movq %rbp, %xmm0 movaps %xmm0, (%r13) nop nop nop nop nop inc %r15 // Faulty Load mov $0x68ce8c0000000ba3, %r15 nop nop nop nop add %rbp, %rbp movb (%r15), %r11b lea oracles, %rdi and $0xff, %r11 shlq $12, %r11 mov (%rdi,%r11,1), %r11 pop %rdx pop %rdi pop %rbp pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_NC', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_NC', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_NC', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'51': 221} 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 */
lorom ;SHARED SPRITE PALETTE FIX ; ;This is a repair so that sprites that previously shared Link's palette ;no longer share his palette. In the vanilla game this was not an issue ;but with custom sprites some very strange color transitions can occur. ; ;The convention in the comments here is that bits are labeled [7:0] ; ;Written by Artheau ;during a cold morning on Oct. 29, 2018 ; ;Bee (Credits) ;Seems like this was a bug in the vanilla game ;This puts the bee on the palette it uses in the rest of the game (bits 1-3) ;Appears virtually identical org $8ECFBA ;$74FBA in ROM db $76 ;Chests (Credits) ;Gives them a much more natural color (bits 1-3) ;There is one hex value for each chest ;The result is a visual improvement org $8ED35A ;7535A in ROM db $37 org $8ED362 ;75362 in ROM db $37 org $8ED36A ;7536A in ROM db $37 ;Sweeping Woman (In-Game) ;Puts her on the same color of red that she is in the ending credits (bits 1-3) org $8DB383 ;6B383 in ROM db $07 ;Ravens (Credits) ;Puts them on the same color as they are in-game (bits 1-3) org $8ED653 ;75653 in ROM db $09 ;Running Man (In-Game) ;Puts the jacket on the same palette as the hat ;bits 1-3 are XORed with the base palette (currently 0b011) org $85E9DA ;2E9DA in ROM db $00 org $85E9EA ;2E9EA in ROM db $40 org $85E9FA ;2E9FA in ROM db $00 org $85EA0A ;2EA0A in ROM db $40 org $85EA1A ;2EA1A in ROM db $00 org $85EA2A ;2EA2A in ROM db $00 org $85EA3A ;2EA3A in ROM db $40 org $85EA4A ;2EA4A in ROM db $40 ;Running Man (Credits Only) ;Puts the jacket and the arm on the same palette as the hat (bits 1-3) org $8ECE72 ;74E72 in ROM db $47 org $8ECE8A ;74E8A in ROM db $07 org $8ECE92 ;74E92 in ROM db $07 org $8ECEA2 ;74EA2 in ROM db $47 org $8ECEAA ;74EAA in ROM db $07 org $8ECEBA ;74EBA in ROM db $47 ;Hoarder (when under a stone) ;Complete fix ;This was a bug that made the hoarder ignore its palette setting only when it was under a rock org $86AAAC ;32AAC in ROM db $F0 ;But now we have to give it the correct palette info (bits 1-3) org $86AA46 ;32A46 in ROM db $0B org $86AA48 ;32A48 in ROM db $0B org $86AA4A ;32A4A in ROM db $0B org $86AA4C ;32A4C in ROM db $0B org $86AA4E ;32A4E in ROM db $4B ;Thief (friendly thief in cave) ;There is a subtle difference in color here (more pastel) ;His palette is given by bits 1-3 org $8DC322 ;6C322 in ROM db $07 ;set him to red ;Alternate palette options: ;db $09 ;lavender ;db $0B ;green ;db $0D ;yellow (same as he is in the credits) ;Pedestal Pull ;This edit DOES create a visual difference ;so I also present some alternate options ; ; ;Option A: Fix the red pendant, but now it ignores shadows ;and as a result, looks bugged ;org $85893D ;2893D in ROM ;db $07 ; ; ;Option B: Make the red pendant a yellow pendant ;org $85893D ;2893D in ROM ;db $0D ; ; ;Option C: Also change the other pendants so that they all ;ignore shadows. This looks better because they appear to ;glow even brighter ;BUT I had to compromise on the color of the blue pendant org $858933 ;28933 in ROM db $05 ;change palette of blue pendant org $858938 ;28938 in ROM db $01 ;change palette of green pendant org $85893D ;2893D in ROM db $07 ;change palette of red pendant ;the pendants travel in a direction determined by their color ;so option C also requires a fix to their directional movement org $858D21 ;28D21 in ROM db $04 org $858D22 ;28D22 in ROM db $04 org $858D23 ;28D23 in ROM db $FC org $858D24 ;28D24 in ROM db $00 org $858D25 ;28D25 in ROM db $FE org $858D26 ;28D26 in ROM db $FE org $858D27 ;28D27 in ROM db $FE org $858D28 ;28D28 in ROM db $FC ;Blind Maiden ;Previously she switched palettes when she arrived at the light (although it was very subtle) ;Here we just set it so that she starts at that color org $8DB410 ;6B410 in ROM db $4B ;sets the palette of the prison sprite (bits 1-3) org $89A8EB ;4A8EB in ROM db $05 ;sets the palette of the tagalong (bits 0-2) ;Crystal Maiden (credits) ;One of the crystal maidens was on Link's palette, but only in the end sequence ;palette given by bits 1-3 org $8EC8C3 ;748C3 in ROM db $37 ;Cukeman (Everywhere) ;This guy is such a bugfest. Did you know that his body remains an enemy and if you try talking to him, ;you have to target the overlaid sprite that only has eyeballs and a mouth? ;This is why you can still be damaged by him. In any case, I digress. Let's talk edits. ; ;These edits specifically target the color of his lips ;Bits 1-3 are XORed with his base ID palette (0b100) ;and the base palette cannot be changed without breaking buzzblobs (i.e. green dancing pickles) org $9AFA93 ;D7A93 in ROM db $0F org $9AFAAB ;D7AAB in ROM db $0F org $9AFAC3 ;D7AC3 in ROM db $0F org $9AFADB ;D7ADB in ROM db $0F org $9AFAF3 ;D7AF3 in ROM db $0F org $9AFB0B ;D7B0B in ROM db $0F ;BUT there is a very specific ramification of the above edits: ;Because his lips were moved to the red palette, his lips ;no longer respond to shadowing effects ;(like how red rupees appear in lost woods) ;this will only be apparent if enemizer places him in areas like lost woods ;or in the end credits sequence during his short cameo, ;so the line below replaces him in the end sequence ;with a buzzblob org $8ED664 ;75664 in ROM db $00 ;number of cukeman in the scene (up to 4)
; A183862: n+floor(sqrt(5n/2)); complement of A183863. ; 2,4,5,7,8,9,11,12,13,15,16,17,18,19,21,22,23,24,25,27,28,29,30,31,32,34,35,36,37,38,39,40,42,43,44,45,46,47,48,50,51,52,53,54,55,56,57,58,60,61,62,63,64,65,66,67,68,70,71,72,73,74,75,76,77,78,79,81,82,83,84,85,86,87,88,89,90,91,93,94 mov $5,$0 mul $0,2 mov $1,$0 add $0,2 add $0,$1 add $0,$1 mov $1,4 trn $3,$0 lpb $0 sub $0,$3 trn $0,1 add $1,1 add $3,5 lpe sub $1,4 mov $2,$5 mov $4,1 lpb $4 add $1,$2 sub $4,1 lpe
<?hh // strict /** * @copyright 2010-2015, The Titon Project * @license http://opensource.org/licenses/bsd-license.php * @link http://titon.io */ namespace Titon\View\Exception; /** * Exception thrown for missing helpers. * * @package Titon\View\Exception */ class MissingHelperException extends \OutOfBoundsException { }
.global s_prepare_buffers s_prepare_buffers: push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x16052, %rsi lea addresses_A_ht+0x1c852, %rdi nop nop nop nop xor $27455, %r15 mov $43, %rcx rep movsb nop nop add $23467, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r8 push %r9 push %rbp push %rbx push %rdi // Store lea addresses_D+0x15292, %r13 nop nop nop nop nop xor %r9, %r9 mov $0x5152535455565758, %rbx movq %rbx, %xmm1 vmovups %ymm1, (%r13) nop nop nop dec %rdi // Load lea addresses_PSE+0x1c952, %r11 nop nop and $19141, %rbp movups (%r11), %xmm0 vpextrq $0, %xmm0, %r13 nop xor %rbp, %rbp // Faulty Load lea addresses_UC+0x5052, %r8 nop nop nop nop dec %rdi movb (%r8), %r11b lea oracles, %rbx and $0xff, %r11 shlq $12, %r11 mov (%rbx,%r11,1), %r11 pop %rdi pop %rbx pop %rbp pop %r9 pop %r8 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}} {'00': 10} 00 00 00 00 00 00 00 00 00 00 */
; A160713: 3 times numbers of Gould's sequence: a(n) = A001316(n)*3. ; 3,6,6,12,6,12,12,24,6,12,12,24,12,24,24,48,6,12,12,24,12,24,24,48,12,24,24,48,24,48,48,96,6,12,12,24,12,24,24,48,12,24,24,48,24,48,48,96,12,24,24,48,24,48,48,96,24,48,48,96,48,96,96,192,6,12,12,24,12,24,24,48 mov $1,$0 lpb $0 div $1,2 sub $0,$1 lpe mul $1,2 pow $1,$0 add $1,1 mul $1,2 sub $1,4 div $1,2 mul $1,3 add $1,3
;// ;// INTEL CORPORATION PROPRIETARY INFORMATION ;// This software is supplied under the terms of a license agreement or ;// nondisclosure agreement with Intel Corporation and may not be copied ;// or disclosed except in accordance with the terms of that agreement. ;// Copyright (c) 2000 Intel Corporation. All Rights Reserved. ;// ;// ; log_wmt.asm ; ; double log(double); ; ; Initial version: 12/15/2000 ; Updated with bug fixes: 2/20/2001 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; Another important feature is that we use the table of log(1/B) ;; ;; throughout. To ensure numerical accuracy, we only need to ensure that ;; ;; T(0)_hi = B(last)_hi, T(0)_lo = B(last)_lo. This ensures W_hi = 0 and ;; ;; W_lo = 0 exactly in the case of |X-1| <= 2^(-7). ;; ;; Finally, we do away with the need for extra-precision addition by the ;; ;; following observation. The three pieces at the end are ;; ;; A = W_hi + r_hi; B = r_lo; C = P + W_lo. ;; ;; When W_hi = W_lo = 0, the addition sequence (A+B) + C is accurate as ;; ;; the sum A+B is exact. ;; ;; Otherwise, A + (B+C) is accurate as B is going to be largely shifted ;; ;; off compared to the final result. ;; ;; Hence if we use compare and mask operations to ;; ;; create alpha = (r_lo or 0), beta = (0 or r_lo), Res_hi <- W_hi+alpha, ;; ;; Res_lo <- C + beta, then result is accurately computed as ;; ;; Res_hi+Res_lo. ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .686P .387 .XMM .MODEL FLAT,C EXTRN C __libm_error_support : NEAR CONST SEGMENT PARA PUBLIC USE32 'CONST' ALIGN 16 emask DQ 000FFFFFFFFFFFFFH, 000FFFFFFFFFFFFFH ; mask off sign/expo field Magic DQ 428FFFFFFFFFF80FH, 428FFFFFFFFFF80FH ; 2^(42)-1+2^(-7) hi_mask DQ 7FFFFFFFFFE00000H, 7FFFFFFFFFE00000H ; mask of bottom 21 bits LOG_2 DQ 3FE62E42FEFA3800H, 3D2EF35793C76730H ; L_hi,L_lo -> [L_lo|L_hi] place_L DQ 0000000000000000H,0FFFFFFFFFFFFFFFFH ; 0,1 -> [FF..FF|00..00] DQ 0FFFFFFFFFFFFFFFFH, 0000000000000000H ; 1,0 -> [00..00|FF..FF] One DQ 3ff0000000000000H, 3ff0000000000000H ; 1,1 Zero DQ 0000000000000000H, 0000000000000000H ; 0,0 Two52 DQ 4330000000000000H, 4330000000000000H ; 2^52 for normalization Infs DQ 0FFF0000000000000H, 7FF0000000000000H ; -inf,+inf --> [+inf|-inf] NaN DQ 7FF0000000000001H, 7FF0000000000001H ; NaN for log(-ve), log(Nan) coeff DQ 3FC24998090DC555H, 0BFCFFFFFFF201E13H ; p6,p3 ->[p3|p6] DQ 0BFC555C54DD57D75H, 3FD55555555555A7H ; p5,p2 ->[p2|p5] DQ 3FC9999998867A53H, 0BFE000000000001CH ; p4,p1 ->[p1|p4] ;-------Table B----------- B_Tbl DQ 3FF0000000000000H, 3FF0000000000000H DQ 3FEF820000000000H, 3FEF820000000000H DQ 3FEF080000000000H, 3FEF080000000000H DQ 3FEE920000000000H, 3FEE920000000000H DQ 3FEE1E0000000000H, 3FEE1E0000000000H DQ 3FEDAE0000000000H, 3FEDAE0000000000H DQ 3FED420000000000H, 3FED420000000000H DQ 3FECD80000000000H, 3FECD80000000000H DQ 3FEC720000000000H, 3FEC720000000000H DQ 3FEC0E0000000000H, 3FEC0E0000000000H DQ 3FEBAC0000000000H, 3FEBAC0000000000H DQ 3FEB4E0000000000H, 3FEB4E0000000000H DQ 3FEAF20000000000H, 3FEAF20000000000H DQ 3FEA980000000000H, 3FEA980000000000H DQ 3FEA420000000000H, 3FEA420000000000H DQ 3FE9EC0000000000H, 3FE9EC0000000000H DQ 3FE99A0000000000H, 3FE99A0000000000H DQ 3FE9480000000000H, 3FE9480000000000H DQ 3FE8FA0000000000H, 3FE8FA0000000000H DQ 3FE8AC0000000000H, 3FE8AC0000000000H DQ 3FE8620000000000H, 3FE8620000000000H DQ 3FE8180000000000H, 3FE8180000000000H DQ 3FE7D00000000000H, 3FE7D00000000000H DQ 3FE78A0000000000H, 3FE78A0000000000H DQ 3FE7460000000000H, 3FE7460000000000H DQ 3FE7020000000000H, 3FE7020000000000H DQ 3FE6C20000000000H, 3FE6C20000000000H DQ 3FE6820000000000H, 3FE6820000000000H DQ 3FE6420000000000H, 3FE6420000000000H DQ 3FE6060000000000H, 3FE6060000000000H DQ 3FE5CA0000000000H, 3FE5CA0000000000H DQ 3FE58E0000000000H, 3FE58E0000000000H DQ 3FE5560000000000H, 3FE5560000000000H DQ 3FE51E0000000000H, 3FE51E0000000000H DQ 3FE4E60000000000H, 3FE4E60000000000H DQ 3FE4B00000000000H, 3FE4B00000000000H DQ 3FE47A0000000000H, 3FE47A0000000000H DQ 3FE4460000000000H, 3FE4460000000000H DQ 3FE4140000000000H, 3FE4140000000000H DQ 3FE3E20000000000H, 3FE3E20000000000H DQ 3FE3B20000000000H, 3FE3B20000000000H DQ 3FE3820000000000H, 3FE3820000000000H DQ 3FE3520000000000H, 3FE3520000000000H DQ 3FE3240000000000H, 3FE3240000000000H DQ 3FE2F60000000000H, 3FE2F60000000000H DQ 3FE2CA0000000000H, 3FE2CA0000000000H DQ 3FE29E0000000000H, 3FE29E0000000000H DQ 3FE2740000000000H, 3FE2740000000000H DQ 3FE24A0000000000H, 3FE24A0000000000H DQ 3FE2200000000000H, 3FE2200000000000H DQ 3FE1F80000000000H, 3FE1F80000000000H DQ 3FE1D00000000000H, 3FE1D00000000000H DQ 3FE1A80000000000H, 3FE1A80000000000H DQ 3FE1820000000000H, 3FE1820000000000H DQ 3FE15C0000000000H, 3FE15C0000000000H DQ 3FE1360000000000H, 3FE1360000000000H DQ 3FE1120000000000H, 3FE1120000000000H DQ 3FE0EC0000000000H, 3FE0EC0000000000H DQ 3FE0CA0000000000H, 3FE0CA0000000000H DQ 3FE0A60000000000H, 3FE0A60000000000H DQ 3FE0840000000000H, 3FE0840000000000H DQ 3FE0620000000000H, 3FE0620000000000H DQ 3FE0420000000000H, 3FE0420000000000H DQ 3FE0200000000000H, 3FE0200000000000H DQ 3FE0000000000000H, 3FE0000000000000H ;-------Table T_hi,T_lo so that movapd gives [ T_lo | T_hi ] T_Tbl DQ 0000000000000000H, 0000000000000000H DQ 3F8FBEA8B13C0000H, 3CDEC927B17E4E13H DQ 3F9F7A9B16780000H, 3D242AD9271BE7D7H DQ 3FA766D923C20000H, 3D1FF0A82F1C24C1H DQ 3FAF0C30C1114000H, 3D31A88653BA4140H DQ 3FB345179B63C000H, 3D3D4203D36150D0H DQ 3FB6EF528C056000H, 3D24573A51306A44H DQ 3FBA956D3ECAC000H, 3D3E63794C02C4AFH DQ 3FBE2507702AE000H, 3D303B433FD6EEDCH DQ 3FC0D79E7CD48000H, 3D3CB422847849E4H DQ 3FC299D30C606000H, 3D3D4D0079DC08D9H DQ 3FC44F8B726F8000H, 3D3DF6A4432B9BB4H DQ 3FC601B076E7A000H, 3D3152D7D4DFC8E5H DQ 3FC7B00916515000H, 3D146280D3E606A3H DQ 3FC9509AA0044000H, 3D3F1E675B4D35C6H DQ 3FCAF6895610D000H, 3D375BEBBA042B64H DQ 3FCC8DF7CB9A8000H, 3D3EEE42F58E1E6EH DQ 3FCE2A877A6B2000H, 3D3823817787081AH DQ 3FCFB7D86EEE3000H, 3D371FCF1923FB43H DQ 3FD0A504E97BB000H, 3D303094E6690C44H DQ 3FD1661CAECB9800H, 3D2D1C000C076A8BH DQ 3FD22981FBEF7800H, 3D17AF7A7DA9FC99H DQ 3FD2E9E2BCE12000H, 3D24300C128D1DC2H DQ 3FD3A71C56BB4800H, 3D08C46FB5A88483H DQ 3FD4610BC29C5800H, 3D385F4D833BCDC7H DQ 3FD51D1D93104000H, 3D35B0FAA20D9C8EH DQ 3FD5D01DC49FF000H, 3D2740AB8CFA5ED3H DQ 3FD68518244CF800H, 3D28722FF88BF119H DQ 3FD73C1800DC0800H, 3D3320DBF75476C0H DQ 3FD7E9883FA49800H, 3D3FAFF96743F289H DQ 3FD898D38A893000H, 3D31F666071E2F57H DQ 3FD94A0428036000H, 3D30E7BCB08C6B44H DQ 3FD9F123F4BF6800H, 3D36892015F2401FH DQ 3FDA99FCABDB8000H, 3D11E89C5F87A311H DQ 3FDB44977C148800H, 3D3C6A343FB526DBH DQ 3FDBEACD9E271800H, 3D268A6EDB879B51H DQ 3FDC92B7D6BB0800H, 3D10FE9FFF876CC2H DQ 3FDD360E90C38000H, 3D342CDB58440FD6H DQ 3FDDD4AA04E1C000H, 3D32D8512DF01AFDH DQ 3FDE74D262788800H, 3CFEB945ED9457BCH DQ 3FDF100F6C2EB000H, 3D2CCE779D37F3D8H DQ 3FDFACC89C9A9800H, 3D163E0D100EC76CH DQ 3FE02582A5C9D000H, 3D222C6C4E98E18CH DQ 3FE0720E5C40DC00H, 3D38E27400B03FBEH DQ 3FE0BF52E7353800H, 3D19B5899CD387D3H DQ 3FE109EB9E2E4C00H, 3D12DA67293E0BE7H DQ 3FE15533D3B8D400H, 3D3D981CA8B0D3C3H DQ 3FE19DB6BA0BA400H, 3D2B675885A4A268H DQ 3FE1E6DF676FF800H, 3D1A58BA81B983AAH DQ 3FE230B0D8BEBC00H, 3D12FC066E48667BH DQ 3FE2779E1EC93C00H, 3D36523373359B79H DQ 3FE2BF29F9841C00H, 3CFD8A3861D3B7ECH DQ 3FE30757344F0C00H, 3D309BE85662F034H DQ 3FE34C80A8958000H, 3D1D4093FCAC34BDH DQ 3FE39240DDE5CC00H, 3D3493DBEAB758B3H DQ 3FE3D89A6B1A5400H, 3D28C7CD5FA81E3EH DQ 3FE41BCFF4860000H, 3D076FD6B90E2A84H DQ 3FE4635BCF40DC00H, 3D2CE8D5D412CAADH DQ 3FE4A3E862342400H, 3D224FA993F78464H DQ 3FE4E8D015786C00H, 3D38B1C0D0303623H DQ 3FE52A6D269BC400H, 3D30022268F689C9H DQ 3FE56C91D71CF800H, 3CE07BAFD1366E9EH DQ 3FE5AB505B390400H, 3CD5627AF66563FAH DQ 3FE5EE82AA241800H, 3D2202380CDA46BEH DQ 3FE62E42FEFA3800H, 3D2EF35793C76730H ALIGN 16 CONST ENDS $cmpsd MACRO op1, op2, op3 LOCAL begin_cmpsd, end_cmpsd begin_cmpsd: cmppd op1, op2, op3 end_cmpsd: org begin_cmpsd db 0F2h org end_cmpsd ENDM _TEXT SEGMENT PARA PUBLIC USE32 'CODE' ALIGN 16 PUBLIC _log_pentium4, _CIlog_pentium4 _CIlog_pentium4 PROC NEAR push ebp mov ebp, esp sub esp, 8 ; for argument DBLSIZE and esp, 0fffffff0h fstp qword ptr [esp] movq xmm0, qword ptr [esp] call start leave ret ;----------------------; ;--Argument Reduction--; ;----------------------; _log_pentium4 label proc movlpd xmm0, QWORD PTR [4+esp] ;... load X to low part of xmm0 start: mov edx,0 ;... set edx to 0 DENORMAL_RETRY: movapd xmm5,xmm0 unpcklpd xmm0,xmm0 ;... [X|X] psrlq xmm5,52 pextrw ecx,xmm5,0 movapd xmm1, QWORD PTR [emask] ;... pair of 000FF...FF movapd xmm3, QWORD PTR [One] ;... pair of 3FF000...000 movapd xmm4, QWORD PTR [Magic] ;... pair of 2^(42)-1+2^(-7) movapd xmm6, QWORD PTR [hi_mask] ;... pair of 7FFFFFFF..FE00000 andpd xmm0,xmm1 orpd xmm0,xmm3 ;... [Y|Y] addpd xmm4,xmm0 ;... 11 lsb contains the index to B ;... the last 4 lsb are don't cares, the ;... 7 bits following that is the index ;... Hence by masking, we already have index*16 pextrw eax,xmm4,0 and eax,000007F0H ;... eax is offset movapd xmm4, QWORD PTR [eax+B_Tbl] ;... [B|B] movapd xmm7, QWORD PTR [eax+T_Tbl] andpd xmm6,xmm0 ;... [Y_hi|Y_hi] subpd xmm0,xmm6 ;... [Y_lo|Y_lo] mulpd xmm6,xmm4 ;... [B*Y_hi|B*Y_hi] subpd xmm6,xmm3 ;... [R_hi|R_hi] addsd xmm7,xmm6 ;... [T_lo|T_hi+R_hi] mulpd xmm0,xmm4 ;... [R_lo|R_lo] movapd xmm4,xmm0 ;... [R_lo|R_lo] addpd xmm0,xmm6 ;... [R|R] ;-----------------------------------------; ;--Approx and Reconstruction in parallel--; ;-----------------------------------------; ;...m is in ecx, [T_lo,T_hi+R_hi] in xmm7 ;...xmm4 through xmm6 will be used and ecx,00000FFFH ;... note we need sign and biased exponent sub ecx,1 cmp ecx,2045 ;... the largest biased exponent 2046-1 ;... if ecx is ABOVE (unsigned) this, either ;... the sign is +ve and biased exponent is 7FF ;... or the sign is +ve and exponent is 0, or ;... the sign is -ve (i.e. sign bit 1) ja SPECIAL_CASES sub ecx,1022 ;... m in integer format add ecx,edx ;... this is the denormal adjustment cvtsi2sd xmm6,ecx unpcklpd xmm6,xmm6 ;... [m | m] in FP format shl ecx,10 add eax,ecx ;16*(64*m + j) 0 <=> (m=-1 & j=64) or (m=0 & j=0) mov ecx,16 mov edx,0 cmp eax,0 cmove edx,ecx ;this is the index into the mask table (place_{L,R}) movapd xmm1, QWORD PTR [coeff] ;... loading [p3|p6] movapd xmm3,xmm0 movapd xmm2, QWORD PTR [coeff+16] ;... loading [p2|p5] mulpd xmm1,xmm0 ;... [p3 R | p6 R] mulpd xmm3,xmm3 ;... [R^2|R^2] addpd xmm1,xmm2 ;... [p2+p3 R |p5+p6 R] movapd xmm2, QWORD PTR [coeff+32] ;... [p1|p4] mulsd xmm3,xmm3 ;... [R^2|R^4] movapd xmm5, QWORD PTR [LOG_2] ;... loading [L_lo|L_hi] ;... [T_lo|T_hi+R_hi] already in xmm7 mulpd xmm6,xmm5 ;... [m L_lo | m L_hi] movapd xmm5, QWORD PTR [edx+place_L] ;... [FF..FF|00.00] or [00..00|FF..FF] andpd xmm4,xmm5 ;... [R_lo|0] or [0|R_lo] addpd xmm7,xmm6 ;... [W_lo|W_hi] addpd xmm7,xmm4 ;... [A_lo|A_hi] mulpd xmm1,xmm0 ;... [p2 R+p3 R^2|p5 R+p6 R^2] mulsd xmm3,xmm0 ;... [R^2|R^5] addpd xmm1,xmm2 ;... [p1+.. | p4+...] movapd xmm6,xmm7 unpckhpd xmm6,xmm6 ;... [*|A_lo] mulpd xmm1,xmm3 ;... [P_hi|P_lo] sub esp, 16 movapd xmm0,xmm1 ;... copy of [P_hi|P_lo] unpckhpd xmm1,xmm1 ;... [P_hi|P_hi] ;...[P_hi|P_lo] in xmm1 at this point addsd xmm0,xmm1 ;... [*|P] addsd xmm0,xmm6 addsd xmm0,xmm7 movlpd QWORD PTR [esp+4], xmm0 ; return result fld QWORD PTR [esp+4] ; add esp, 16 ret SPECIAL_CASES: movlpd xmm0, QWORD PTR [4+esp] ;... load X again movapd xmm1, QWORD PTR [Zero] $cmpsd xmm1,xmm0,0 pextrw eax,xmm1,0 ;... ones if X = +-0.0 cmp eax,0 ja INPUT_ZERO cmp ecx,-1 ;... ecx = -1 iff X is positive denormal je INPUT_DENORM cmp ecx,000007FEH ja INPUT_NEGATIVE movlpd xmm0, QWORD PTR [4+esp] movapd xmm1, QWORD PTR [emask] movapd xmm2, QWORD PTR [One] andpd xmm0,xmm1 orpd xmm0,xmm2 ;... xmm0 is 1 iff the input argument was +inf $cmpsd xmm2,xmm0,0 pextrw eax,xmm2,0 ;... 0 if X is NaN cmp eax, 0 je INPUT_NaN INPUT_INF: ;....Input is +Inf fld QWORD PTR [Infs+8] ; ret INPUT_NaN: ; movlpd xmm0, QWORD PTR [esp+4] ; addsd xmm0, xmm0 ; sub esp, 16 ; movlpd QWORD PTR [esp+4], xmm0 ; return result ; fld QWORD PTR [esp+4] ; ; add esp, 16 ; ret mov edx, 1000 jmp CALL_LIBM_ERROR INPUT_ZERO: ; raise Divide by Zero movlpd xmm2, QWORD PTR [One] divsd xmm2, xmm0 movlpd xmm1, QWORD PTR [Infs] mov edx, 2 jmp CALL_LIBM_ERROR INPUT_DENORM: ;....check for zero or denormal ;....for now I assume this is simply denormal ;....in reality, we need to check for zero and handle appropriately movlpd xmm1,Two52 mulsd xmm0,xmm1 mov edx,-52 ;...set adjustment to exponent jmp DENORMAL_RETRY ;...branch back INPUT_NEGATIVE: add ecx,1 and ecx, 7ffH cmp ecx, 7ffH jae NEG_INF_NAN NEG_NORMAL_INFINITY: ; xmm1=0 xorpd xmm1, xmm1 ; raise Invalid divsd xmm1, xmm1 mov edx, 3 CALL_LIBM_ERROR: ;call libm_error_support(void *arg1,void *arg2,void *retval,error_types input_tag) sub esp, 28 movlpd QWORD PTR [esp+16], xmm1 mov DWORD PTR [esp+12],edx mov edx, esp add edx,16 mov DWORD PTR [esp+8],edx add edx,16 mov DWORD PTR [esp+4],edx mov DWORD PTR [esp],edx call NEAR PTR __libm_error_support ; movlpd xmm0, QWORD PTR [esp+16] ; movlpd QWORD PTR [esp+16], xmm0 ; return result fld QWORD PTR [esp+16] ; add esp,28 ret NEG_INF_NAN: movlpd xmm2, QWORD PTR [esp+4] movlpd xmm0, QWORD PTR [esp+4] movd eax, xmm2 psrlq xmm2, 32 movd ecx, xmm2 and ecx, 0fffffH ; eliminate sign/exponent or eax, ecx cmp eax,0 jz NEG_NORMAL_INFINITY ; negative infinity ; addsd xmm0, xmm0 ; sub esp,16 ; movlpd QWORD PTR [esp+4], xmm0 ; fld QWORD PTR [esp+4] ; add esp, 16 ; ret mov edx, 1000 jmp CALL_LIBM_ERROR _CIlog_pentium4 ENDP ALIGN 16 _TEXT ENDS END
global start section .text bits 32 start: ; print `OK` to screen mov dword [0xb8000], 0x2f4b2f4f hlt
// Eggs.Variant // // Copyright Agustin K-ballo Berge, Fusion Fenix 2014-2015 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include <eggs/variant.hpp> #include <string> #include <typeinfo> #include <type_traits> #include <eggs/variant/detail/config/prefix.hpp> #define CATCH_CONFIG_MAIN #include "catch.hpp" #include "constexpr.hpp" EGGS_CXX11_STATIC_CONSTEXPR std::size_t npos = eggs::variant<>::npos; TEST_CASE("variant<Ts...>::variant(variant<Ts...>&&)", "[variant.cnstr]") { eggs::variant<int, std::string> v1(42); REQUIRE(bool(v1) == true); REQUIRE(v1.which() == 0u); REQUIRE(*v1.target<int>() == 42); eggs::variant<int, std::string> v2(std::move(v1)); CHECK(bool(v1) == true); CHECK(bool(v2) == true); CHECK(v2.which() == v1.which()); REQUIRE(v1.target<int>() != nullptr); CHECK(*v1.target<int>() == 42); SECTION("list-initialization") { eggs::variant<int, std::string> v = {}; CHECK(bool(v) == false); CHECK(v.which() == npos); CHECK(v.target() == nullptr); #if EGGS_CXX98_HAS_RTTI CHECK(v.target_type() == typeid(void)); #endif } #if EGGS_CXX11_STD_HAS_IS_TRIVIALLY_COPYABLE SECTION("trivially_copyable") { eggs::variant<int, float> v1(42); REQUIRE(bool(v1) == true); REQUIRE(v1.which() == 0u); REQUIRE(*v1.target<int>() == 42); CHECK(std::is_trivially_copyable<decltype(v1)>::value == true); eggs::variant<int, float> v2(std::move(v1)); CHECK(bool(v1) == true); CHECK(bool(v2) == true); CHECK(v2.which() == v1.which()); REQUIRE(v1.target<int>() != nullptr); CHECK(*v1.target<int>() == 42); REQUIRE(v2.target<int>() != nullptr); CHECK(*v2.target<int>() == 42); } #endif #if EGGS_CXX14_HAS_CONSTEXPR SECTION("constexpr") { struct test { static constexpr int call() { eggs::variant<int, ConstexprTrivial> v1(ConstexprTrivial(42)); eggs::variant<int, ConstexprTrivial> v2(std::move(v1)); return 0; }}; constexpr int c = test::call(); } #endif } TEST_CASE("variant<>::variant(variant<>&&)", "[variant.cnstr]") { eggs::variant<> v1; REQUIRE(bool(v1) == false); REQUIRE(v1.which() == npos); eggs::variant<> v2(std::move(v1)); CHECK(bool(v1) == false); CHECK(bool(v2) == false); CHECK(v2.which() == v1.which()); SECTION("list-initialization") { eggs::variant<> v = {}; CHECK(bool(v) == false); CHECK(v.which() == npos); CHECK(v.target() == nullptr); #if EGGS_CXX98_HAS_RTTI CHECK(v.target_type() == typeid(void)); #endif } #if EGGS_CXX14_HAS_CONSTEXPR SECTION("constexpr") { struct test { static constexpr int call() { eggs::variant<> v1; eggs::variant<> v2(std::move(v1)); return 0; }}; constexpr int c = test::call(); } #endif }
; TP-EXO6: Reads a four-digit integer and prints the sum of its digits. pile segment para stack 'pile' db 256 dup(0) pile ends data segment buf db 4+1, ?, 4 dup(?) ; maxLength+1 + actualLength + data msg db 'Entrez un nombre: $' sum db 13, 10, 'La somme de ses chiffres est XY$' data ends code segment main proc far assume cs:code, ds:data, ss:pile mov ax, data mov ds, ax mov ah, 09h ; print string function mov dx, offset msg int 21h mov ah, 0Ah ; read buffer function mov dx, offset buf int 21h mov DL, buf[1] ; Data Length dec DL ; because we start from zero mov bx, 0 ; index mov ax, 0 ; result nextDigit: add al, buf[bx+2] sub al, '0' cmp dl, bl je print inc bl jmp nextDigit print: ; Example: AX=13, BL=10 > AX div BL > AL=1 AH=3 mov bl, 10 div bl ; => AL = AX div 10; AL = AX mod 10 add ax, 3030h ; convert to characters by adding '00' mov sum[31], al ; fill in the "sum" string mov sum[32], ah ; ... mov ah, 09h ; print string function mov dx, offset sum int 21h mov ah, 4Ch ; exit to MS-DOS function mov al, 0 ; exit code success int 21h main endp code ends end main
********************************************************************************* * DynoSprite - game/levels/00-marbledemo.asm * Copyright (c) 2013-2014, Richard Goedeken * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ********************************************************************************* * Note: The dynamic Level handling code is always loaded first in the level/object code page, * and this page is always mapped to $6000 when being accesssed in the DynoSprite core. * For this reason, you may use position-dependent instructions if desired for local data * and code. * ----------------------------------------------------------------------------- * -- Type definitions only * ----------------------------------------------------------------------------- include datastruct.asm include dynosprite-symbols.asm MapWidth equ 800 MapHeight equ 80 org $6000 * ----------------------------------------------------------------------------- * -- Initialization Functions for setting up demo * ----------------------------------------------------------------------------- * Local data Tetris01 fcb 0,0,0,1,1,1,2,1 Tetris02 fcb 0,1,1,1,2,1,2,0 Tetris03 fcb 0,0,1,0,0,1,1,1 Tetris04 fcb 1,0,0,1,1,1,2,1 Tetris05 fcb 1,0,2,0,0,1,1,1 Tetris06 fcb 0,0,1,0,1,1,2,1 Tetris07 fcb 0,0,1,0,2,0,3,0 *********************************************************** * Level_Initialize: * * - IN: None * - OUT: None * - Trashed: A,B,X,Y,U *********************************************************** Level_Initialize * set the background map size to 800 x 80 blocks ldd #MapWidth std <Gfx_BkgrndMapWidth ldd #MapHeight std <Gfx_BkgrndMapHeight * the loader only allocates 1 page for the tilemap in this level * since we generate the map programmatically instead of loading it from disk, * we need to allocate seven more pages for the tilemap (total size 64k) lda #8 sta <Gfx_BkgrndMapPages lda #VH_BKMAP+1 AllocBlocksLoop@ jsr MemMgr_AllocateBlock inca cmpa #VH_BKMAP+8 bne AllocBlocksLoop@ * clear the map lda #VH_BKMAP ClearBlock@ pshs a ldb #4 jsr MemMgr_MapBlock ldd #0 ldx #$8000 ! std ,x std 2,x std 4,x std 6,x leax 8,x cmpx #$A000 bne < puls a inca cmpa #VH_BKMAP+8 bne ClearBlock@ * draw an outline lda #VH_BKMAP ldb #4 jsr MemMgr_MapBlock lda #1 ldx #$8000 ldy <Gfx_BkgrndMapWidth ! sta ,x+ leay -1,y bne < ldb #2 leax -1,x lda #VH_BKMAP ldu <Gfx_BkgrndMapWidth stu <SMC_leaxY1@+2,PCR ldy <Gfx_BkgrndMapHeight OutlineYL1@ stb ,x leay -1,y beq EastWallDone@ SMC_leaxY1@ leax 999,x * just use large number to force assembler to use 16-bit offset cmpx #$A000 blo OutlineYL1@ inca * advance to the next tilemap page leax -$2000,x pshs a,b,x ldb #4 jsr MemMgr_MapBlock puls a,b,x bra OutlineYL1@ EastWallDone@ lda #VH_BKMAP ldb #4 jsr MemMgr_MapBlock lda #VH_BKMAP ldb #3 ldx #$8000 ldu <Gfx_BkgrndMapWidth stu <SMC_leaxY2@+2,PCR ldy <Gfx_BkgrndMapHeight OutlineYL2@ stb ,x leay -1,y beq WestWallDone@ SMC_leaxY2@ leax 999,x * just use large number to force assembler to use 16-bit offset cmpx #$A000 blo OutlineYL2@ inca * advance to the next tilemap page leax -$2000,x pshs a,b,x ldb #4 jsr MemMgr_MapBlock puls a,b,x bra OutlineYL2@ WestWallDone@ inca * map in the next tilemap page in case we cross the boundary cmpa #VH_BKMAP+8 beq > pshs x ldb #5 jsr MemMgr_MapBlock puls x ! ldb #4 ldy <Gfx_BkgrndMapWidth ! stb ,x+ leay -1,y bne < * debug fixme: reset the $8000-$DFFF logical space to the first 2 pages of tilemap space lda #VH_BKMAP ldb #4 jsr MemMgr_MapBlock lda #VH_BKMAP+1 ldb #5 jsr MemMgr_MapBlock * Fill in the map with tetris blocks ldx #2000 BlockLoop@ pshs x BlockTryX@ * get random starting location jsr Util_Random ldb <Gfx_BkgrndMapHeight+1 * height must be less than 256 blocks subb #4 mul adda #2 * A is random number between 2 and MapHeight-3 pshs a ldb <Gfx_BkgrndMapWidth+1 mul tfr d,x puls a ldb <Gfx_BkgrndMapWidth mul tfr b,a clrb leax d,x * X is offset to random tilemap row ldd <Gfx_BkgrndMapWidth subd #4 jsr Util_RandomRange16 addd #2 leax d,x * X is offset to random tile in tilemap from (2,2) to (MaxX-3,MaxY-3) tfr x,d anda #$1F exg x,d * X is page offset (0000-1fff) lsra lsra lsra lsra lsra * A is page number (0-7) adda #VH_BKMAP cmpx #$1000 blo LowerPageHalf@ pshs a,x ldb #4 jsr MemMgr_MapBlock puls a inca incb cmpa #VH_BKMAP+8 beq > jsr MemMgr_MapBlock ! puls x leax $8000,x bra PickBlockType@ LowerPageHalf@ pshs a,x ldb #5 jsr MemMgr_MapBlock puls a deca decb cmpa #VH_BKMAP-1 beq > jsr MemMgr_MapBlock ! puls x leax $A000,x PickBlockType@ * select random block type and orientation ! jsr Util_Random anda #$7 beq < ldy #Tetris01 deca tfr a,b lsrb incb pshs b * B is color (1-4) lsla lsla lsla leay a,y * Y is pointer to tetris block coordinates for selected piece type jsr Util_Random anda #3 * A is orientation (0-3) puls b pshs a,b,x,y jsr Piece_Test tsta bne BlockGood@ puls a,b,x,y lbra BlockTryX@ BlockGood@ puls a,b,x,y jsr Piece_Write puls x leax -1,x lbne BlockLoop@ * all done rts * X = pointer to origin coordinate in tilemap for this candidate tetris piece * Y = pointer to 4 block coordinates (X,Y) which are always positive * A = orientation (0-3) * B = color (1-4) * Out: A=0 for fail, A=1 for pass Piece_Test ldb #4 stb PieceCounter lsla ldu #PTO_Table jmp [a,u] PieceCounter fcb 0 PTO_Table fdb TestO1,TestO2,TestO3,TestO4 NegLines fdb 0,-MapWidth,-MapWidth*2,-MapWidth*3 PosLines fdb 0,MapWidth,MapWidth*2,MapWidth*3 TestO1 * +X, +Y ldu #PosLines ldb 1,y lslb ldd b,u leau d,x lda ,y++ leau a,u jsr Block_Test beq > dec PieceCounter bne TestO1 ! rts TestO2 * -Y, +X ldu #NegLines ldb ,y+ lslb ldd b,u leau d,x lda ,y+ leau a,u jsr Block_Test beq > dec PieceCounter bne TestO2 ! rts TestO3 * -X, -Y ldu #NegLines ldb 1,y lslb ldd b,u leau d,x lda ,y++ nega leau a,u jsr Block_Test beq > dec PieceCounter bne TestO3 ! rts TestO4 * +Y, -X ldu #PosLines ldb ,y+ lslb ldd b,u leau d,x lda ,y+ nega leau a,u jsr Block_Test beq > dec PieceCounter bne TestO4 ! rts Block_Test tst -MapWidth-1,u bne > tst -MapWidth,u bne > tst -MapWidth+1,u bne > tst -1,u bne > tst ,u bne > tst 1,u bne > tst MapWidth-1,u bne > tst MapWidth,u bne > tst MapWidth+1,u bne > lda #1 rts ! clra rts Piece_Write * X = pointer to origin coordinate in tilemap for this candidate tetris piece * Y = pointer to 4 block coordinates (X,Y) which are always positive * A = orientation (0-3) * B = color (1-4) lsla ldu #PWO_Table leau a,u lda #4 sta PieceCounter jmp [,u] PWO_Table fdb WriteO1,WriteO2,WriteO3,WriteO4 WriteO1 * +X, +Y pshs b ! ldu #PosLines ldb 1,y lslb ldd b,u leau d,x lda ,y++ leau a,u ldb ,s stb ,u dec PieceCounter bne < puls b rts WriteO2 * -Y, +X pshs b ! ldu #NegLines ldb ,y+ lslb ldd b,u leau d,x lda ,y+ leau a,u ldb ,s stb ,u dec PieceCounter bne < puls b rts WriteO3 * -X, -Y pshs b ! ldu #NegLines ldb 1,y lslb ldd b,u leau d,x lda ,y++ nega leau a,u ldb ,s stb ,u dec PieceCounter bne < puls b rts WriteO4 * +Y, -X pshs b ! ldu #PosLines ldb ,y+ lslb ldd b,u leau d,x lda ,y+ nega leau a,u ldb ,s stb ,u dec PieceCounter bne < puls b rts *********************************************************** * Level_CalculateBkgrndNewXY: * * - IN: None * - OUT: None * - Trashed: A,B,X,U *********************************************************** * This function evaluates the joystick position and calculates a * new background X/Y starting location for the next frame. It * uses 8 bits of fractional position in each dimension to * give a smooth range of speeds AccelFactor EQU 50 DecelFactor EQU 25 MaxSpeed EQU 512 Level_CalculateBkgrndNewXY * reload level on button press lda <Input_Buttons anda #Joy1Button1 bne > * pop the return address off the stack, because we will never return from this function leas 2,s lda #1 jmp Ldr_Jump_To_New_Level * update X coordinate based on joystick ! ldx <Gfx_BkgrndNewX * get X coordinate of last rendered frame stx <Gfx_BkgrndLastX ldb <Input_JoystickX * start by handling X direction scrolling cmpb #16 blo XLeft@ cmpb #48 bhi XRight@ XCenter@ ldd <Demo_ScreenDeltaX88 beq XDone@ blt XCenter1@ subd #DecelFactor * decelerate bgt XDone@ clra clrb bra XDone@ XCenter1@ addd #DecelFactor * decelerate blt XDone@ clra clrb bra XDone@ XLeft@ ldd <Demo_ScreenDeltaX88 ble > clra clrb bra XDone@ ! subd #AccelFactor * accelerate to the left cmpd #-MaxSpeed bge XDone@ ldd #-MaxSpeed bra XDone@ XRight@ ldd <Demo_ScreenDeltaX88 bge > clra clrb bra XDone@ ! addd #AccelFactor * accelerate to the right cmpd #MaxSpeed ble XDone@ ldd #MaxSpeed XDone@ std <Demo_ScreenDeltaX88 * multiply the position delta if we skipped a frame tst <Obj_MotionFactor bmi MotionXDone@ * D = 1X bne > lslb rola bra MotionXDone@ * D = 2X ! lslb rola addd <Demo_ScreenDeltaX88 * D = 3X MotionXDone@ addb <Gfx_BkgrndXFrac adca #0 stb <Gfx_BkgrndXFrac leax a,x stx <Gfx_BkgrndNewX * store X coordinate for new frame to render ldx <Gfx_BkgrndNewY * get Y coordinate of last rendered frame stx <Gfx_BkgrndLastY ldb <Input_JoystickY cmpb #16 blo YUp@ cmpb #48 bhi YDown@ YCenter@ ldd <Demo_ScreenDeltaY88 beq YDone@ blt YCenter1@ subd #DecelFactor * decelerate bgt YDone@ clra clrb bra YDone@ YCenter1@ addd #DecelFactor * decelerate blt YDone@ clra clrb bra YDone@ YUp@ ldd <Demo_ScreenDeltaY88 ble > clra clrb bra YDone@ ! subd #AccelFactor * accelerate up cmpd #-MaxSpeed bge YDone@ ldd #-MaxSpeed bra YDone@ YDown@ ldd <Demo_ScreenDeltaY88 bge > clra clrb bra YDone@ ! addd #AccelFactor * accelerate down cmpd #MaxSpeed ble YDone@ ldd #MaxSpeed YDone@ std <Demo_ScreenDeltaY88 * multiply the position delta if we skipped a frame tst <Obj_MotionFactor bmi MotionYDone@ * D = 1X bne > lslb rola bra MotionYDone@ * D = 2X ! lslb rola addd <Demo_ScreenDeltaY88 * D = 3X MotionYDone@ addb <Gfx_BkgrndYFrac adca #0 stb <Gfx_BkgrndYFrac leax a,x stx <Gfx_BkgrndNewY * store X coordinate for new frame to render rts
/** ****************************************************************************** * This file is part of the TouchGFX 4.12.3 distribution. * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under Ultimate Liberty license * SLA0044, the "License"; You may not use this file except in compliance with * the License. You may obtain a copy of the License at: * www.st.com/SLA0044 * ****************************************************************************** */ #include <touchgfx/containers/progress_indicators/BoxProgress.hpp> namespace touchgfx { BoxProgress::BoxProgress() : AbstractDirectionProgress(), box() { progressIndicatorContainer.add(box); } BoxProgress::~BoxProgress() { } void BoxProgress::setProgressIndicatorPosition(int16_t x, int16_t y, int16_t width, int16_t height) { box.setPosition(0, 0, width, height); AbstractProgressIndicator::setProgressIndicatorPosition(x, y, width, height); } void BoxProgress::setColor(colortype color) { box.setColor(color); } touchgfx::colortype BoxProgress::getColor() const { return box.getColor(); } void BoxProgress::setAlpha(uint8_t alpha) { box.setAlpha(alpha); } uint8_t BoxProgress::getAlpha() const { return box.getAlpha(); } void BoxProgress::setValue(int value) { AbstractProgressIndicator::setValue(value); box.invalidate(); int16_t progress = 0; switch (progressDirection) { case AbstractDirectionProgress::RIGHT: case AbstractDirectionProgress::LEFT: progress = AbstractProgressIndicator::getProgress(progressIndicatorContainer.getWidth()); break; case AbstractDirectionProgress::DOWN: case AbstractDirectionProgress::UP: progress = AbstractProgressIndicator::getProgress(progressIndicatorContainer.getHeight()); break; } switch (progressDirection) { case AbstractDirectionProgress::RIGHT: box.setPosition(0, 0, progress, progressIndicatorContainer.getHeight()); break; case AbstractDirectionProgress::LEFT: box.setPosition(getWidth() - progress, 0, progress, progressIndicatorContainer.getHeight()); break; case AbstractDirectionProgress::DOWN: box.setPosition(0, 0, progressIndicatorContainer.getWidth(), progress); break; case AbstractDirectionProgress::UP: box.setPosition(0, progressIndicatorContainer.getHeight() - progress, progressIndicatorContainer.getWidth(), progress); break; } box.invalidate(); } }
INCLUDE "clib_cfg.asm" SECTION code_l_sdcc PUBLIC __modulong EXTERN l_divu_32_32x32 __modulong: ; unsigned 32-bit mod ; ; enter : stack = divisor (32-bit), dividend (32-bit), ret ; ; exit : dehl = remainder ; dehl'= quotient pop af exx pop hl pop de ; dehl' = dividend exx pop hl pop de ; dehl = divisor push de push hl push de push hl push af IF (__CLIB_OPT_IMATH <= 50) || (__SDCC_IY) call l_divu_32_32x32 exx ret ENDIF IF (__CLIB_OPT_IMATH > 50) && (__SDCC_IX) push ix call l_divu_32_32x32 pop ix exx ret ENDIF
LDD r0, Y+1 LDD r1, Y+2
Route12Gate2F_h: db GATE ; tileset db ROUTE_12_GATE_2F_HEIGHT, ROUTE_12_GATE_2F_WIDTH ; dimensions (y, x) dw Route12Gate2F_Blocks ; blocks dw Route12Gate2F_TextPointers ; texts dw Route12Gate2F_Script ; scripts db 0 ; connections dw Route12Gate2F_Object ; objects
_programming: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "types.h" #include "stat.h" #include "user.h" #include "fcntl.h" int main(int argc,char* argv[]){ 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: eb fe jmp 3 <main+0x3> 5: 66 90 xchg %ax,%ax 7: 66 90 xchg %ax,%ax 9: 66 90 xchg %ax,%ax b: 66 90 xchg %ax,%ax d: 66 90 xchg %ax,%ax f: 90 nop 00000010 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 10: 55 push %ebp 11: 89 e5 mov %esp,%ebp 13: 53 push %ebx 14: 8b 45 08 mov 0x8(%ebp),%eax 17: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 1a: 89 c2 mov %eax,%edx 1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 20: 83 c1 01 add $0x1,%ecx 23: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 27: 83 c2 01 add $0x1,%edx 2a: 84 db test %bl,%bl 2c: 88 5a ff mov %bl,-0x1(%edx) 2f: 75 ef jne 20 <strcpy+0x10> ; return os; } 31: 5b pop %ebx 32: 5d pop %ebp 33: c3 ret 34: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 3a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000040 <strcmp>: int strcmp(const char *p, const char *q) { 40: 55 push %ebp 41: 89 e5 mov %esp,%ebp 43: 56 push %esi 44: 53 push %ebx 45: 8b 55 08 mov 0x8(%ebp),%edx 48: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 4b: 0f b6 02 movzbl (%edx),%eax 4e: 0f b6 19 movzbl (%ecx),%ebx 51: 84 c0 test %al,%al 53: 75 1e jne 73 <strcmp+0x33> 55: eb 29 jmp 80 <strcmp+0x40> 57: 89 f6 mov %esi,%esi 59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 60: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 63: 0f b6 02 movzbl (%edx),%eax p++, q++; 66: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 69: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 6d: 84 c0 test %al,%al 6f: 74 0f je 80 <strcmp+0x40> 71: 89 f1 mov %esi,%ecx 73: 38 d8 cmp %bl,%al 75: 74 e9 je 60 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 77: 29 d8 sub %ebx,%eax } 79: 5b pop %ebx 7a: 5e pop %esi 7b: 5d pop %ebp 7c: c3 ret 7d: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 80: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 82: 29 d8 sub %ebx,%eax } 84: 5b pop %ebx 85: 5e pop %esi 86: 5d pop %ebp 87: c3 ret 88: 90 nop 89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000090 <strlen>: uint strlen(char *s) { 90: 55 push %ebp 91: 89 e5 mov %esp,%ebp 93: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 96: 80 39 00 cmpb $0x0,(%ecx) 99: 74 12 je ad <strlen+0x1d> 9b: 31 d2 xor %edx,%edx 9d: 8d 76 00 lea 0x0(%esi),%esi a0: 83 c2 01 add $0x1,%edx a3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) a7: 89 d0 mov %edx,%eax a9: 75 f5 jne a0 <strlen+0x10> ; return n; } ab: 5d pop %ebp ac: c3 ret uint strlen(char *s) { int n; for(n = 0; s[n]; n++) ad: 31 c0 xor %eax,%eax ; return n; } af: 5d pop %ebp b0: c3 ret b1: eb 0d jmp c0 <memset> b3: 90 nop b4: 90 nop b5: 90 nop b6: 90 nop b7: 90 nop b8: 90 nop b9: 90 nop ba: 90 nop bb: 90 nop bc: 90 nop bd: 90 nop be: 90 nop bf: 90 nop 000000c0 <memset>: void* memset(void *dst, int c, uint n) { c0: 55 push %ebp c1: 89 e5 mov %esp,%ebp c3: 57 push %edi c4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : c7: 8b 4d 10 mov 0x10(%ebp),%ecx ca: 8b 45 0c mov 0xc(%ebp),%eax cd: 89 d7 mov %edx,%edi cf: fc cld d0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } d2: 89 d0 mov %edx,%eax d4: 5f pop %edi d5: 5d pop %ebp d6: c3 ret d7: 89 f6 mov %esi,%esi d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000000e0 <strchr>: char* strchr(const char *s, char c) { e0: 55 push %ebp e1: 89 e5 mov %esp,%ebp e3: 53 push %ebx e4: 8b 45 08 mov 0x8(%ebp),%eax e7: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) ea: 0f b6 10 movzbl (%eax),%edx ed: 84 d2 test %dl,%dl ef: 74 1d je 10e <strchr+0x2e> if(*s == c) f1: 38 d3 cmp %dl,%bl f3: 89 d9 mov %ebx,%ecx f5: 75 0d jne 104 <strchr+0x24> f7: eb 17 jmp 110 <strchr+0x30> f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 100: 38 ca cmp %cl,%dl 102: 74 0c je 110 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 104: 83 c0 01 add $0x1,%eax 107: 0f b6 10 movzbl (%eax),%edx 10a: 84 d2 test %dl,%dl 10c: 75 f2 jne 100 <strchr+0x20> if(*s == c) return (char*)s; return 0; 10e: 31 c0 xor %eax,%eax } 110: 5b pop %ebx 111: 5d pop %ebp 112: c3 ret 113: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000120 <gets>: char* gets(char *buf, int max) { 120: 55 push %ebp 121: 89 e5 mov %esp,%ebp 123: 57 push %edi 124: 56 push %esi 125: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 126: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 128: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 12b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 12e: eb 29 jmp 159 <gets+0x39> cc = read(0, &c, 1); 130: 83 ec 04 sub $0x4,%esp 133: 6a 01 push $0x1 135: 57 push %edi 136: 6a 00 push $0x0 138: e8 2d 01 00 00 call 26a <read> if(cc < 1) 13d: 83 c4 10 add $0x10,%esp 140: 85 c0 test %eax,%eax 142: 7e 1d jle 161 <gets+0x41> break; buf[i++] = c; 144: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 148: 8b 55 08 mov 0x8(%ebp),%edx 14b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 14d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 14f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 153: 74 1b je 170 <gets+0x50> 155: 3c 0d cmp $0xd,%al 157: 74 17 je 170 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 159: 8d 5e 01 lea 0x1(%esi),%ebx 15c: 3b 5d 0c cmp 0xc(%ebp),%ebx 15f: 7c cf jl 130 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 161: 8b 45 08 mov 0x8(%ebp),%eax 164: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 168: 8d 65 f4 lea -0xc(%ebp),%esp 16b: 5b pop %ebx 16c: 5e pop %esi 16d: 5f pop %edi 16e: 5d pop %ebp 16f: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 170: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 173: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 175: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 179: 8d 65 f4 lea -0xc(%ebp),%esp 17c: 5b pop %ebx 17d: 5e pop %esi 17e: 5f pop %edi 17f: 5d pop %ebp 180: c3 ret 181: eb 0d jmp 190 <stat> 183: 90 nop 184: 90 nop 185: 90 nop 186: 90 nop 187: 90 nop 188: 90 nop 189: 90 nop 18a: 90 nop 18b: 90 nop 18c: 90 nop 18d: 90 nop 18e: 90 nop 18f: 90 nop 00000190 <stat>: int stat(char *n, struct stat *st) { 190: 55 push %ebp 191: 89 e5 mov %esp,%ebp 193: 56 push %esi 194: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 195: 83 ec 08 sub $0x8,%esp 198: 6a 00 push $0x0 19a: ff 75 08 pushl 0x8(%ebp) 19d: e8 f0 00 00 00 call 292 <open> if(fd < 0) 1a2: 83 c4 10 add $0x10,%esp 1a5: 85 c0 test %eax,%eax 1a7: 78 27 js 1d0 <stat+0x40> return -1; r = fstat(fd, st); 1a9: 83 ec 08 sub $0x8,%esp 1ac: ff 75 0c pushl 0xc(%ebp) 1af: 89 c3 mov %eax,%ebx 1b1: 50 push %eax 1b2: e8 f3 00 00 00 call 2aa <fstat> 1b7: 89 c6 mov %eax,%esi close(fd); 1b9: 89 1c 24 mov %ebx,(%esp) 1bc: e8 b9 00 00 00 call 27a <close> return r; 1c1: 83 c4 10 add $0x10,%esp 1c4: 89 f0 mov %esi,%eax } 1c6: 8d 65 f8 lea -0x8(%ebp),%esp 1c9: 5b pop %ebx 1ca: 5e pop %esi 1cb: 5d pop %ebp 1cc: c3 ret 1cd: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 1d0: b8 ff ff ff ff mov $0xffffffff,%eax 1d5: eb ef jmp 1c6 <stat+0x36> 1d7: 89 f6 mov %esi,%esi 1d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001e0 <atoi>: return r; } int atoi(const char *s) { 1e0: 55 push %ebp 1e1: 89 e5 mov %esp,%ebp 1e3: 53 push %ebx 1e4: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 1e7: 0f be 11 movsbl (%ecx),%edx 1ea: 8d 42 d0 lea -0x30(%edx),%eax 1ed: 3c 09 cmp $0x9,%al 1ef: b8 00 00 00 00 mov $0x0,%eax 1f4: 77 1f ja 215 <atoi+0x35> 1f6: 8d 76 00 lea 0x0(%esi),%esi 1f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 200: 8d 04 80 lea (%eax,%eax,4),%eax 203: 83 c1 01 add $0x1,%ecx 206: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 20a: 0f be 11 movsbl (%ecx),%edx 20d: 8d 5a d0 lea -0x30(%edx),%ebx 210: 80 fb 09 cmp $0x9,%bl 213: 76 eb jbe 200 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 215: 5b pop %ebx 216: 5d pop %ebp 217: c3 ret 218: 90 nop 219: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000220 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 220: 55 push %ebp 221: 89 e5 mov %esp,%ebp 223: 56 push %esi 224: 53 push %ebx 225: 8b 5d 10 mov 0x10(%ebp),%ebx 228: 8b 45 08 mov 0x8(%ebp),%eax 22b: 8b 75 0c mov 0xc(%ebp),%esi char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 22e: 85 db test %ebx,%ebx 230: 7e 14 jle 246 <memmove+0x26> 232: 31 d2 xor %edx,%edx 234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 238: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 23c: 88 0c 10 mov %cl,(%eax,%edx,1) 23f: 83 c2 01 add $0x1,%edx { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 242: 39 da cmp %ebx,%edx 244: 75 f2 jne 238 <memmove+0x18> *dst++ = *src++; return vdst; } 246: 5b pop %ebx 247: 5e pop %esi 248: 5d pop %ebp 249: c3 ret 0000024a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 24a: b8 01 00 00 00 mov $0x1,%eax 24f: cd 40 int $0x40 251: c3 ret 00000252 <exit>: SYSCALL(exit) 252: b8 02 00 00 00 mov $0x2,%eax 257: cd 40 int $0x40 259: c3 ret 0000025a <wait>: SYSCALL(wait) 25a: b8 03 00 00 00 mov $0x3,%eax 25f: cd 40 int $0x40 261: c3 ret 00000262 <pipe>: SYSCALL(pipe) 262: b8 04 00 00 00 mov $0x4,%eax 267: cd 40 int $0x40 269: c3 ret 0000026a <read>: SYSCALL(read) 26a: b8 05 00 00 00 mov $0x5,%eax 26f: cd 40 int $0x40 271: c3 ret 00000272 <write>: SYSCALL(write) 272: b8 10 00 00 00 mov $0x10,%eax 277: cd 40 int $0x40 279: c3 ret 0000027a <close>: SYSCALL(close) 27a: b8 15 00 00 00 mov $0x15,%eax 27f: cd 40 int $0x40 281: c3 ret 00000282 <kill>: SYSCALL(kill) 282: b8 06 00 00 00 mov $0x6,%eax 287: cd 40 int $0x40 289: c3 ret 0000028a <exec>: SYSCALL(exec) 28a: b8 07 00 00 00 mov $0x7,%eax 28f: cd 40 int $0x40 291: c3 ret 00000292 <open>: SYSCALL(open) 292: b8 0f 00 00 00 mov $0xf,%eax 297: cd 40 int $0x40 299: c3 ret 0000029a <mknod>: SYSCALL(mknod) 29a: b8 11 00 00 00 mov $0x11,%eax 29f: cd 40 int $0x40 2a1: c3 ret 000002a2 <unlink>: SYSCALL(unlink) 2a2: b8 12 00 00 00 mov $0x12,%eax 2a7: cd 40 int $0x40 2a9: c3 ret 000002aa <fstat>: SYSCALL(fstat) 2aa: b8 08 00 00 00 mov $0x8,%eax 2af: cd 40 int $0x40 2b1: c3 ret 000002b2 <link>: SYSCALL(link) 2b2: b8 13 00 00 00 mov $0x13,%eax 2b7: cd 40 int $0x40 2b9: c3 ret 000002ba <mkdir>: SYSCALL(mkdir) 2ba: b8 14 00 00 00 mov $0x14,%eax 2bf: cd 40 int $0x40 2c1: c3 ret 000002c2 <chdir>: SYSCALL(chdir) 2c2: b8 09 00 00 00 mov $0x9,%eax 2c7: cd 40 int $0x40 2c9: c3 ret 000002ca <dup>: SYSCALL(dup) 2ca: b8 0a 00 00 00 mov $0xa,%eax 2cf: cd 40 int $0x40 2d1: c3 ret 000002d2 <getpid>: SYSCALL(getpid) 2d2: b8 0b 00 00 00 mov $0xb,%eax 2d7: cd 40 int $0x40 2d9: c3 ret 000002da <sbrk>: SYSCALL(sbrk) 2da: b8 0c 00 00 00 mov $0xc,%eax 2df: cd 40 int $0x40 2e1: c3 ret 000002e2 <sleep>: SYSCALL(sleep) 2e2: b8 0d 00 00 00 mov $0xd,%eax 2e7: cd 40 int $0x40 2e9: c3 ret 000002ea <uptime>: SYSCALL(uptime) 2ea: b8 0e 00 00 00 mov $0xe,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <dob>: SYSCALL(dob) 2f2: b8 16 00 00 00 mov $0x16,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <fgproc>: SYSCALL(fgproc) 2fa: b8 17 00 00 00 mov $0x17,%eax 2ff: cd 40 int $0x40 301: c3 ret 302: 66 90 xchg %ax,%ax 304: 66 90 xchg %ax,%ax 306: 66 90 xchg %ax,%ax 308: 66 90 xchg %ax,%ax 30a: 66 90 xchg %ax,%ax 30c: 66 90 xchg %ax,%ax 30e: 66 90 xchg %ax,%ax 00000310 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 310: 55 push %ebp 311: 89 e5 mov %esp,%ebp 313: 57 push %edi 314: 56 push %esi 315: 53 push %ebx 316: 89 c6 mov %eax,%esi 318: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 31b: 8b 5d 08 mov 0x8(%ebp),%ebx 31e: 85 db test %ebx,%ebx 320: 74 7e je 3a0 <printint+0x90> 322: 89 d0 mov %edx,%eax 324: c1 e8 1f shr $0x1f,%eax 327: 84 c0 test %al,%al 329: 74 75 je 3a0 <printint+0x90> neg = 1; x = -xx; 32b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 32d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 334: f7 d8 neg %eax 336: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 339: 31 ff xor %edi,%edi 33b: 8d 5d d7 lea -0x29(%ebp),%ebx 33e: 89 ce mov %ecx,%esi 340: eb 08 jmp 34a <printint+0x3a> 342: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 348: 89 cf mov %ecx,%edi 34a: 31 d2 xor %edx,%edx 34c: 8d 4f 01 lea 0x1(%edi),%ecx 34f: f7 f6 div %esi 351: 0f b6 92 d8 06 00 00 movzbl 0x6d8(%edx),%edx }while((x /= base) != 0); 358: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 35a: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 35d: 75 e9 jne 348 <printint+0x38> if(neg) 35f: 8b 45 c4 mov -0x3c(%ebp),%eax 362: 8b 75 c0 mov -0x40(%ebp),%esi 365: 85 c0 test %eax,%eax 367: 74 08 je 371 <printint+0x61> buf[i++] = '-'; 369: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 36e: 8d 4f 02 lea 0x2(%edi),%ecx 371: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 375: 8d 76 00 lea 0x0(%esi),%esi 378: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 37b: 83 ec 04 sub $0x4,%esp 37e: 83 ef 01 sub $0x1,%edi 381: 6a 01 push $0x1 383: 53 push %ebx 384: 56 push %esi 385: 88 45 d7 mov %al,-0x29(%ebp) 388: e8 e5 fe ff ff call 272 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 38d: 83 c4 10 add $0x10,%esp 390: 39 df cmp %ebx,%edi 392: 75 e4 jne 378 <printint+0x68> putc(fd, buf[i]); } 394: 8d 65 f4 lea -0xc(%ebp),%esp 397: 5b pop %ebx 398: 5e pop %esi 399: 5f pop %edi 39a: 5d pop %ebp 39b: c3 ret 39c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 3a0: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3a2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 3a9: eb 8b jmp 336 <printint+0x26> 3ab: 90 nop 3ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 000003b0 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 3b0: 55 push %ebp 3b1: 89 e5 mov %esp,%ebp 3b3: 57 push %edi 3b4: 56 push %esi 3b5: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 3b6: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 3b9: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 3bc: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 3bf: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 3c2: 89 45 d0 mov %eax,-0x30(%ebp) 3c5: 0f b6 1e movzbl (%esi),%ebx 3c8: 83 c6 01 add $0x1,%esi 3cb: 84 db test %bl,%bl 3cd: 0f 84 b0 00 00 00 je 483 <printf+0xd3> 3d3: 31 d2 xor %edx,%edx 3d5: eb 39 jmp 410 <printf+0x60> 3d7: 89 f6 mov %esi,%esi 3d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 3e0: 83 f8 25 cmp $0x25,%eax 3e3: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 3e6: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 3eb: 74 18 je 405 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 3ed: 8d 45 e2 lea -0x1e(%ebp),%eax 3f0: 83 ec 04 sub $0x4,%esp 3f3: 88 5d e2 mov %bl,-0x1e(%ebp) 3f6: 6a 01 push $0x1 3f8: 50 push %eax 3f9: 57 push %edi 3fa: e8 73 fe ff ff call 272 <write> 3ff: 8b 55 d4 mov -0x2c(%ebp),%edx 402: 83 c4 10 add $0x10,%esp 405: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 408: 0f b6 5e ff movzbl -0x1(%esi),%ebx 40c: 84 db test %bl,%bl 40e: 74 73 je 483 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 410: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 412: 0f be cb movsbl %bl,%ecx 415: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 418: 74 c6 je 3e0 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 41a: 83 fa 25 cmp $0x25,%edx 41d: 75 e6 jne 405 <printf+0x55> if(c == 'd'){ 41f: 83 f8 64 cmp $0x64,%eax 422: 0f 84 f8 00 00 00 je 520 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 428: 81 e1 f7 00 00 00 and $0xf7,%ecx 42e: 83 f9 70 cmp $0x70,%ecx 431: 74 5d je 490 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 433: 83 f8 73 cmp $0x73,%eax 436: 0f 84 84 00 00 00 je 4c0 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 43c: 83 f8 63 cmp $0x63,%eax 43f: 0f 84 ea 00 00 00 je 52f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 445: 83 f8 25 cmp $0x25,%eax 448: 0f 84 c2 00 00 00 je 510 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 44e: 8d 45 e7 lea -0x19(%ebp),%eax 451: 83 ec 04 sub $0x4,%esp 454: c6 45 e7 25 movb $0x25,-0x19(%ebp) 458: 6a 01 push $0x1 45a: 50 push %eax 45b: 57 push %edi 45c: e8 11 fe ff ff call 272 <write> 461: 83 c4 0c add $0xc,%esp 464: 8d 45 e6 lea -0x1a(%ebp),%eax 467: 88 5d e6 mov %bl,-0x1a(%ebp) 46a: 6a 01 push $0x1 46c: 50 push %eax 46d: 57 push %edi 46e: 83 c6 01 add $0x1,%esi 471: e8 fc fd ff ff call 272 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 476: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 47a: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 47d: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 47f: 84 db test %bl,%bl 481: 75 8d jne 410 <printf+0x60> putc(fd, c); } state = 0; } } } 483: 8d 65 f4 lea -0xc(%ebp),%esp 486: 5b pop %ebx 487: 5e pop %esi 488: 5f pop %edi 489: 5d pop %ebp 48a: c3 ret 48b: 90 nop 48c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 490: 83 ec 0c sub $0xc,%esp 493: b9 10 00 00 00 mov $0x10,%ecx 498: 6a 00 push $0x0 49a: 8b 5d d0 mov -0x30(%ebp),%ebx 49d: 89 f8 mov %edi,%eax 49f: 8b 13 mov (%ebx),%edx 4a1: e8 6a fe ff ff call 310 <printint> ap++; 4a6: 89 d8 mov %ebx,%eax 4a8: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4ab: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 4ad: 83 c0 04 add $0x4,%eax 4b0: 89 45 d0 mov %eax,-0x30(%ebp) 4b3: e9 4d ff ff ff jmp 405 <printf+0x55> 4b8: 90 nop 4b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 4c0: 8b 45 d0 mov -0x30(%ebp),%eax 4c3: 8b 18 mov (%eax),%ebx ap++; 4c5: 83 c0 04 add $0x4,%eax 4c8: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 4cb: b8 d0 06 00 00 mov $0x6d0,%eax 4d0: 85 db test %ebx,%ebx 4d2: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 4d5: 0f b6 03 movzbl (%ebx),%eax 4d8: 84 c0 test %al,%al 4da: 74 23 je 4ff <printf+0x14f> 4dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 4e0: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4e3: 8d 45 e3 lea -0x1d(%ebp),%eax 4e6: 83 ec 04 sub $0x4,%esp 4e9: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 4eb: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4ee: 50 push %eax 4ef: 57 push %edi 4f0: e8 7d fd ff ff call 272 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 4f5: 0f b6 03 movzbl (%ebx),%eax 4f8: 83 c4 10 add $0x10,%esp 4fb: 84 c0 test %al,%al 4fd: 75 e1 jne 4e0 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4ff: 31 d2 xor %edx,%edx 501: e9 ff fe ff ff jmp 405 <printf+0x55> 506: 8d 76 00 lea 0x0(%esi),%esi 509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 510: 83 ec 04 sub $0x4,%esp 513: 88 5d e5 mov %bl,-0x1b(%ebp) 516: 8d 45 e5 lea -0x1b(%ebp),%eax 519: 6a 01 push $0x1 51b: e9 4c ff ff ff jmp 46c <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 520: 83 ec 0c sub $0xc,%esp 523: b9 0a 00 00 00 mov $0xa,%ecx 528: 6a 01 push $0x1 52a: e9 6b ff ff ff jmp 49a <printf+0xea> 52f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 532: 83 ec 04 sub $0x4,%esp 535: 8b 03 mov (%ebx),%eax 537: 6a 01 push $0x1 539: 88 45 e4 mov %al,-0x1c(%ebp) 53c: 8d 45 e4 lea -0x1c(%ebp),%eax 53f: 50 push %eax 540: 57 push %edi 541: e8 2c fd ff ff call 272 <write> 546: e9 5b ff ff ff jmp 4a6 <printf+0xf6> 54b: 66 90 xchg %ax,%ax 54d: 66 90 xchg %ax,%ax 54f: 90 nop 00000550 <free>: static Header base; static Header *freep; void free(void *ap) { 550: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 551: a1 68 09 00 00 mov 0x968,%eax static Header base; static Header *freep; void free(void *ap) { 556: 89 e5 mov %esp,%ebp 558: 57 push %edi 559: 56 push %esi 55a: 53 push %ebx 55b: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 55e: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 560: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 563: 39 c8 cmp %ecx,%eax 565: 73 19 jae 580 <free+0x30> 567: 89 f6 mov %esi,%esi 569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 570: 39 d1 cmp %edx,%ecx 572: 72 1c jb 590 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 574: 39 d0 cmp %edx,%eax 576: 73 18 jae 590 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 578: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 57a: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 57c: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 57e: 72 f0 jb 570 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 580: 39 d0 cmp %edx,%eax 582: 72 f4 jb 578 <free+0x28> 584: 39 d1 cmp %edx,%ecx 586: 73 f0 jae 578 <free+0x28> 588: 90 nop 589: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 590: 8b 73 fc mov -0x4(%ebx),%esi 593: 8d 3c f1 lea (%ecx,%esi,8),%edi 596: 39 d7 cmp %edx,%edi 598: 74 19 je 5b3 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 59a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 59d: 8b 50 04 mov 0x4(%eax),%edx 5a0: 8d 34 d0 lea (%eax,%edx,8),%esi 5a3: 39 f1 cmp %esi,%ecx 5a5: 74 23 je 5ca <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 5a7: 89 08 mov %ecx,(%eax) freep = p; 5a9: a3 68 09 00 00 mov %eax,0x968 } 5ae: 5b pop %ebx 5af: 5e pop %esi 5b0: 5f pop %edi 5b1: 5d pop %ebp 5b2: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 5b3: 03 72 04 add 0x4(%edx),%esi 5b6: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 5b9: 8b 10 mov (%eax),%edx 5bb: 8b 12 mov (%edx),%edx 5bd: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 5c0: 8b 50 04 mov 0x4(%eax),%edx 5c3: 8d 34 d0 lea (%eax,%edx,8),%esi 5c6: 39 f1 cmp %esi,%ecx 5c8: 75 dd jne 5a7 <free+0x57> p->s.size += bp->s.size; 5ca: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 5cd: a3 68 09 00 00 mov %eax,0x968 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 5d2: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 5d5: 8b 53 f8 mov -0x8(%ebx),%edx 5d8: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 5da: 5b pop %ebx 5db: 5e pop %esi 5dc: 5f pop %edi 5dd: 5d pop %ebp 5de: c3 ret 5df: 90 nop 000005e0 <malloc>: return freep; } void* malloc(uint nbytes) { 5e0: 55 push %ebp 5e1: 89 e5 mov %esp,%ebp 5e3: 57 push %edi 5e4: 56 push %esi 5e5: 53 push %ebx 5e6: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 5e9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 5ec: 8b 15 68 09 00 00 mov 0x968,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 5f2: 8d 78 07 lea 0x7(%eax),%edi 5f5: c1 ef 03 shr $0x3,%edi 5f8: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 5fb: 85 d2 test %edx,%edx 5fd: 0f 84 a3 00 00 00 je 6a6 <malloc+0xc6> 603: 8b 02 mov (%edx),%eax 605: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 608: 39 cf cmp %ecx,%edi 60a: 76 74 jbe 680 <malloc+0xa0> 60c: 81 ff 00 10 00 00 cmp $0x1000,%edi 612: be 00 10 00 00 mov $0x1000,%esi 617: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 61e: 0f 43 f7 cmovae %edi,%esi 621: ba 00 80 00 00 mov $0x8000,%edx 626: 81 ff ff 0f 00 00 cmp $0xfff,%edi 62c: 0f 46 da cmovbe %edx,%ebx 62f: eb 10 jmp 641 <malloc+0x61> 631: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 638: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 63a: 8b 48 04 mov 0x4(%eax),%ecx 63d: 39 cf cmp %ecx,%edi 63f: 76 3f jbe 680 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 641: 39 05 68 09 00 00 cmp %eax,0x968 647: 89 c2 mov %eax,%edx 649: 75 ed jne 638 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 64b: 83 ec 0c sub $0xc,%esp 64e: 53 push %ebx 64f: e8 86 fc ff ff call 2da <sbrk> if(p == (char*)-1) 654: 83 c4 10 add $0x10,%esp 657: 83 f8 ff cmp $0xffffffff,%eax 65a: 74 1c je 678 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 65c: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 65f: 83 ec 0c sub $0xc,%esp 662: 83 c0 08 add $0x8,%eax 665: 50 push %eax 666: e8 e5 fe ff ff call 550 <free> return freep; 66b: 8b 15 68 09 00 00 mov 0x968,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 671: 83 c4 10 add $0x10,%esp 674: 85 d2 test %edx,%edx 676: 75 c0 jne 638 <malloc+0x58> return 0; 678: 31 c0 xor %eax,%eax 67a: eb 1c jmp 698 <malloc+0xb8> 67c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 680: 39 cf cmp %ecx,%edi 682: 74 1c je 6a0 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 684: 29 f9 sub %edi,%ecx 686: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 689: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 68c: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 68f: 89 15 68 09 00 00 mov %edx,0x968 return (void*)(p + 1); 695: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 698: 8d 65 f4 lea -0xc(%ebp),%esp 69b: 5b pop %ebx 69c: 5e pop %esi 69d: 5f pop %edi 69e: 5d pop %ebp 69f: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 6a0: 8b 08 mov (%eax),%ecx 6a2: 89 0a mov %ecx,(%edx) 6a4: eb e9 jmp 68f <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 6a6: c7 05 68 09 00 00 6c movl $0x96c,0x968 6ad: 09 00 00 6b0: c7 05 6c 09 00 00 6c movl $0x96c,0x96c 6b7: 09 00 00 base.s.size = 0; 6ba: b8 6c 09 00 00 mov $0x96c,%eax 6bf: c7 05 70 09 00 00 00 movl $0x0,0x970 6c6: 00 00 00 6c9: e9 3e ff ff ff jmp 60c <malloc+0x2c>
;Sprite source code generated with EASYSOURCE V3.02 ; 1991/92 Albin Hessler Software ;************************************************ ; -> tech <- 1993 Jul 03 00:22:41 section sprite xdef mes_tech xref mes_zero mes_tech sp1_tech dc.w $0100,$0000 ;form, time/adaption dc.w $0018,$000F ;x size, y size dc.w $0011,$0009 ;x origin, y origin dc.l cp1_tech-* ;pointer to colour pattern dc.l mes_zero-* ;pointer to pattern mask dc.l 0 ;pointer to next definition cp1_tech dc.w $FFFF,$FBFB,$0000,$0000 dc.w $C0FF,$1BFB,$6060,$0000 dc.w $C0FF,$1BFB,$6060,$0000 dc.w $C3FF,$9BFB,$6C6C,$0000 dc.w $C6FE,$7878,$0C0C,$0000 dc.w $C1FF,$9B9B,$E0E0,$0000 dc.w $C0FF,$66E6,$7F7F,$0000 dc.w $C0FF,$18F8,$637F,$0000 dc.w $FFFF,$E0E0,$637F,$0000 dc.w $0000,$3F3F,$83FF,$0000 dc.w $3F3F,$989F,$03FF,$0000 dc.w $0000,$181F,$03FF,$0000 dc.w $0F0F,$D8DF,$03FF,$0000 dc.w $0000,$181F,$03FF,$0000 dc.w $0303,$DFDF,$FFFF,$0000 ; end
; A247128: Positive numbers that are congruent to {0,5,9,13,17} mod 22. ; 5,9,13,17,22,27,31,35,39,44,49,53,57,61,66,71,75,79,83,88,93,97,101,105,110,115,119,123,127,132,137,141,145,149,154,159,163,167,171,176,181,185,189,193,198,203,207,211,215,220,225,229,233,237,242,247,251,255,259,264,269,273,277,281,286,291,295,299,303,308,313,317,321,325,330,335,339,343,347,352,357,361,365,369,374,379,383,387,391,396,401,405,409,413,418,423,427,431,435,440,445,449,453,457,462,467,471,475,479,484,489,493,497,501,506,511,515,519,523,528,533,537,541,545,550,555,559,563,567,572,577,581,585,589,594,599,603,607,611,616,621,625,629,633,638,643,647,651,655,660,665,669,673,677,682,687,691,695,699,704,709,713,717,721,726,731,735,739,743,748,753,757,761,765,770,775,779,783,787,792,797,801,805,809,814,819,823,827,831,836,841,845,849,853,858,863,867,871,875,880,885,889,893,897,902,907,911,915,919,924,929,933,937,941,946,951,955,959,963,968,973,977,981,985,990,995,999,1003,1007,1012,1017,1021,1025,1029,1034,1039,1043,1047,1051,1056,1061,1065,1069,1073,1078,1083,1087,1091,1095,1100 mov $3,$0 add $0,1 lpb $0,1 sub $0,1 mov $2,4 sub $2,$3 trn $2,1 add $1,$2 add $1,2 trn $3,5 lpe
; A095815: n + largest digit of n. ; 2,4,6,8,10,12,14,16,18,11,12,14,16,18,20,22,24,26,28,22,23,24,26,28,30,32,34,36,38,33,34,35,36,38,40,42,44,46,48,44,45,46,47,48,50,52,54,56,58,55,56,57,58,59,60,62,64,66,68,66,67,68,69,70,71,72,74,76,78,77,78,79,80,81,82,83,84,86,88,88,89,90,91,92,93,94,95,96,98,99,100,101,102,103,104,105,106,107,108,101 add $0,1 mov $3,$0 lpb $0 mov $2,$0 div $0,10 mod $2,10 trn $1,$2 add $1,$2 lpe add $1,$3 mov $0,$1
//Forth refinement of Adaptive Exterior Light and Speed Control System //Hight Beam //from ELS-30 to ELS-38 module CarSystem004HighBeam import ../../StandardLibrary import CarSystem004Functions export * signature: enum domain CameraState = {CAMERA_READY | CAMERA_DIRTY | CAMERA_NOTREADY} // Camera state enum domain CruiseControlMode = {CCM0 | CCM1 | CCM2} enum domain PitmanArmForthBack = {BACKWARD | FORWARD | NEUTRAL_FB} // Pitman arm positions - horizontal position domain HighBeamMotor subsetof Integer // High beam illumination distance //0=65,1=100,2 = 120, 3 = 140, 4 = 160, 5= 180, 6 = 200, 7=220, etc. See table at page 23. // FUNCTIONS monitored cameraState: CameraState // Camera state: ready, dirty or not ready monitored oncomingTraffic: Boolean // Camera signal to detect oncoming vehicles. True -> vehicles oncoming, False -> no vehicles monitored pitmanArmForthBack: PitmanArmForthBack // Position of the pitman arm - horizontal position monitored cruiseControlMode: CruiseControlMode // State of cruise control controlled highBeamOn: Boolean // High beam headlights (left and right) are on (True) or not (False) controlled highBeamRange: HighBeamRange // High beam luminous strenght controlled highBeamMotor: HighBeamMotor // Control the high beam illumination - 20m step size //controlled lightRotarySwitchPrevious: LightSwitch // Position of the light rotary switch in the previous state controlled pitmanArmForthBackPrevious: PitmanArmForthBack // Position of the pitman arm - horizontal position - in the previous state controlled setVehicleSpeed: CurrentSpeed // Desired speed in case an adaptive cruise control is part of the vehicle derived adaptiveHighBeamActivated: Boolean derived adaptiveHighBeamDeactivated: Boolean derived headlampFlasherActivated: Boolean //Temporary activation of the high beam (without engaging, so-called flasher) derived headlampFlasherDeactivated: Boolean derived headlampFixedActivated: Boolean //Fixed activation of the high beam derived headlampFixedDeactivated: Boolean derived drivesFasterThan: Prod(CurrentSpeed,Integer) -> Boolean derived lightIlluminationDistance: CurrentSpeed -> HighBeamMotor derived luminousStrength: CurrentSpeed -> HighBeamRange derived calculateSpeed: CurrentSpeed static percentageHBM: Integer -> HighBeamMotor definitions: // DOMAIN DEFINITIONS domain HighBeamMotor = {0..14} // FUNCTION DEFINITIONS //Formulas for graphs in Figure 7 and 8 (as "reverse engineered") //Figure 7 //f(x) = x^2.2 * 0.0025 + 95 if x <= 171 //f(x) = 300 if x > 171 //Figure 8 //f(x) = (7*x+60)/9 function percentageHBM($x in Integer) = if $x <= 65 then 0 else if $x <= 100 then 1 else if $x <= 120 then 2 else if $x <= 140 then 3 else if $x <= 160 then 4 else if $x <= 180 then 5 else if $x <= 200 then 6 else if $x <= 220 then 7 else if $x <= 240 then 8 else if $x <= 260 then 9 else if $x <= 280 then 10 else if $x <= 300 then 11 else if $x <= 320 then 12 else if $x <= 340 then 13 else if $x <= 360 then 14 endif endif endif endif endif endif endif endif endif endif endif endif endif endif endif //Formulas for graphs in Figure 7 and 8 (as "reverse engineered") function lightIlluminationDistance($y in CurrentSpeed) = let ($x = $y/10) in if ($x <= 171.0 ) then percentageHBM(rtoi($x * $x * 2.0 * 0.00025 + 95.0)) else 11 //300 m endif endlet function luminousStrength($x in CurrentSpeed) = if $x <= 1200 then rtoi((7*$x/10 + 60.0)/9.0) else 100 endif //ELS-37 If an adaptive cruise control is part of the vehicle, the light illumination distance is not calculated upon the actual //vehicle speed but the target speed provided by the advanced cruise control. function calculateSpeed = if (cruiseControlMode=CCM2) then setVehicleSpeed else currentSpeed endif function drivesFasterThan($speed in CurrentSpeed, $x in Integer) = $speed >= $x //faster than $x km/h //ELS32 If the light rotary switch is in position Auto, the adaptive high beam is activated by moving the pitman arm to the back //ELS-42 function adaptiveHighBeamActivated = (lightRotarySwitch = AUTO and engineOn(keyState) and pitmanArmForthBack = BACKWARD and not subVoltage and cameraState=CAMERA_READY) //ELS-38 If the pitman arm is moved again in the horizontal neutral position, the adaptive high beam headlight is deactivated. //ELS-43 ELS-49 function adaptiveHighBeamDeactivated = (lightRotarySwitch = AUTO and pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = BACKWARD and subVoltage and cameraState!=CAMERA_READY) function headlampFlasherActivated = (pitmanArmForthBack = FORWARD and pitmanArmForthBackPrevious = NEUTRAL_FB) function headlampFlasherDeactivated = (pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = FORWARD) function headlampFixedActivated = (pitmanArmForthBack = BACKWARD and (lightRotarySwitch = ON or (lightRotarySwitch = AUTO and cameraState!=CAMERA_READY)) and (keyState = KEYINSERTED or engineOn(keyState))) function headlampFixedDeactivated = //( (pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = BACKWARD and lightRotarySwitch = ON) or lightRotarySwitch = OFF or keyState = NOKEYINSERTED) ( (pitmanArmForthBack = NEUTRAL_FB and pitmanArmForthBackPrevious = BACKWARD and lightRotarySwitch = ON) or ((lightRotarySwitch = OFF or keyState = NOKEYINSERTED) and not headlampFlasherActivated)) macro rule r_set_high_beam_headlights($v in Boolean, $d in HighBeamMotor, $l in HighBeamRange) = par highBeamOn := $v highBeamMotor := $d highBeamRange := setOverVoltageValueHighBeam($l) endpar macro rule r_Manual_high_beam_headlights = par //ELS-30 if headlampFlasherActivated then r_set_high_beam_headlights[true,14,100] //max illumination area 360m, 100% luminous strenght (percentage) endif //ELS-30-31 if headlampFlasherDeactivated or headlampFixedDeactivated then highBeamOn := false endif //ELS-31 if headlampFixedActivated then r_set_high_beam_headlights[true,7,100] //illumination area of 220m, 100% luminous strenght (percentage) endif endpar //ELS-33 @E_MAPE_HBH //Sets the values, as calculated by the planner, for the lighting high beam actuators: highBeamOn to activate and deactivate the high beam, //highBeamRange to control the high beam luminous, and highBeamMotor to control the high beam illumination distance. macro rule r_Execute_HBH ($setHighBeam in Boolean, $setHighBeamMotor in HighBeamMotor, $setHighBeamRange in HighBeamRange) = r_set_high_beam_headlights[$setHighBeam,$setHighBeamMotor,$setHighBeamRange] //ELS-33 @P_MAPE_HBH //Plans street illumination according to the characteristic curves for light illumination distance and for luminous strength //depending on the vehicle speed macro rule r_IncreasingPlan_HBH = let ($d = lightIlluminationDistance(calculateSpeed), $l = luminousStrength(calculateSpeed)) in r_Execute_HBH[true,$d,$l] endlet //ELS-34 @P_MAPE_HBH //Reduce street illumination by reducing the area of illumination to 65 meters by an adjustment of the headlight position //as well as by reduction of the luminous strength to 30%. //depending on the vehicle speed macro rule r_DecreasingPlan_HBH = r_Execute_HBH[true,30,0] //ELS-33-34-35 @MA_MAPE_HBH //All MAPE computations of the MAPE loop are executed within one single ASM-step machine. //Note that we do not model the time constraints ('within 2 seconds', 'within 0.5 seconds') macro rule r_Monitor_Analyze_HBH = if adaptiveHighBeamActivated then par if drivesFasterThan(currentSpeed,300) and not oncomingTraffic then //ELS-33 ELS-35 (checks if adaptation is necessary) //the street should be illuminated accordingly r_IncreasingPlan_HBH[] endif if oncomingTraffic then //ELS-34 (checks if adaptation is necessary) //an activated high beam headlight is reduced to low beam headlight. r_DecreasingPlan_HBH[] endif endpar endif macro rule r_MAPE_HBH = //MAPE loop may start and stop par r_Monitor_Analyze_HBH[] if adaptiveHighBeamDeactivated then highBeamOn := false endif //ELS-38 If the pitman arm is moved again in the horizontal neutral position, //the adaptive high beam headlight is deactivated. endpar macro rule r_HighBeam = par pitmanArmForthBackPrevious := pitmanArmForthBack r_Manual_high_beam_headlights[] r_MAPE_HBH[] endpar
; Send AT-command and wait for result. ; HL - Z-terminated AT-command(with CR/LF) ; A: ; 1 - Success ; 0 - Failed okErrCmd: call uartWriteStringZ okErrCmdLp: call uartReadBlocking call pushRing ld hl, response_ok call searchRing cp 1 jr z, okErrOk ld hl, response_err call searchRing cp 1 jr z, okErrErr ld hl, response_fail call searchRing cp 1 jr z, okErrErr jp okErrCmdLp okErrOk ld a, 1 ret okErrErr ld a, 0 ret ; Gets packet from network ; packet will be in var 'output_buffer' ; received packet size in var 'bytes_avail' ; ; If connection was closed it calls 'closed_callback' getPacket call uartReadBlocking call pushRing ld hl, closed call searchRing cp 1 jp z, closed_callback ld hl, ipd call searchRing cp 1 jr nz, getPacket call count_ipd_lenght ld (bytes_avail), hl push hl pop bc ld hl, output_buffer readp: push bc push hl call uartReadBlocking pop hl ld (hl), a pop bc dec bc inc hl ld a, b or c jr nz, readp ld hl, (bytes_avail) ret count_ipd_lenght ld hl,0 ; count lenght cil1 push hl call uartReadBlocking push af call pushRing pop af pop hl cp ':' ret z sub 0x30 ld c,l ld b,h add hl,hl add hl,hl add hl,bc add hl,hl ld c,a ld b,0 add hl,bc jr cil1 ; HL - z-string to hostname or ip ; DE - z-string to port startTcp: push de push hl ld hl, cmd_open1 call uartWriteStringZ pop hl call uartWriteStringZ ld hl, cmd_open2 call uartWriteStringZ pop de call uartWriteStringZ ld hl, cmd_open3 call okErrCmd ret ; Returns: ; A: 1 - Success ; 0 - Failed sendByte: push af ld hl, cmd_send_b call okErrCmd cp 1 jr nz, sbErr sbLp call uartReadBlocking ld hl, send_prompt call searchRing cp 1 jr nz, sbLp pop af ld (sbyte_buff), a call okErrCmd ret sbErr: pop af ld a, 0 ret cmd_cmux defb "AT+CIPMUX=0",13,10,0 ; Single connection mode cmd_inf_off defb "AT+CIPDINFO=0",13,10,0 ; doesn't send me info about remote port and ip cmd_open1 defb "AT+CIPSTART=", #22, "TCP", #22, ",", #22, 0 cmd_open2 defb #22, ",", 0 cmd_open3 defb 13, 10, 0 cmd_close defb "AT+CIPCLOSE",13,10,0 cmd_send_b defb "AT+CIPSEND=1", 13, 10,0 closed defb "CLOSED", 13, 10, 0 ipd defb 13, 10, "+IPD,", 0 response_rdy defb 'ready', 0 response_ok defb 'OK', 13, 10, 0 ; Sucessful operation response_err defb 13,10,'ERROR',13,10,0 ; Failed operation response_fail defb 13,10,'FAIL',13,10,0 ; Failed connection to WiFi. For us same as ERROR ssid defs 80 pass defs 80 bytes_avail defw 0 sbyte_buff defb 0, 0 send_prompt defb ">",0
/* MIT License Copyright (c) 2021 Astrocat.App Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "folderviewmodel.h" #include <QDir> FolderViewModel::FolderViewModel() { rootItem = invisibleRootItem(); rootFolder = new FolderNode(); } QStringList foo(const QString& str) { QDir dir(str); QStringList folders; do { folders.prepend(dir.dirName()); dir.cdUp(); } while (!dir.isRoot()); return folders; } void FolderViewModel::addItem(QString volume, QString folderPath) { QStandardItem *parentItem = rootItem; FolderNode* iterator = rootFolder; int rootrow = 0; for (auto child : iterator->children) { if (child->folderName == volume) { iterator = child; parentItem = parentItem->child(rootrow); break; } rootrow++; } if (iterator == rootFolder) { // volumes.insert(volume); auto node = new FolderNode(); node->folderName = volume; iterator = node; rootFolder->children.append(node); QStandardItem *item = new QStandardItem(volume); item->setData(QVariant::fromValue(node)); parentItem->appendRow(item); parentItem = item; } folders[folderPath]++; auto paths = foo(folderPath); for (auto path : paths) { auto original = iterator; int row = 0; for (auto child : iterator->children) { if (child->folderName == path) { parentItem = parentItem->child(row); iterator = child; break; } row++; } if (iterator == original) { // we did not find it auto node = new FolderNode(); node->folderName = path; iterator->children.append(node); iterator = node; QStandardItem *item = new QStandardItem(path); item->setData(folderPath); parentItem->appendRow(item); parentItem = item; } else { // we found it continue; } } } void FolderViewModel::removeItem(QString volume, QString folderPath) { folders[folderPath]--; }
include '8086.inc' include 'format/mz.inc' entry code:start ; program entry point stack 100h ; stack size segment code start: mov ax,data mov ds,ax mov dx,hello call extra:write_text mov ax,4C00h int 21h segment data hello db 'Hello world!',24h segment extra write_text: mov ah,9 int 21h retf
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x16567, %rax nop nop inc %r11 movups (%rax), %xmm7 vpextrq $1, %xmm7, %r8 sub $2808, %rdx lea addresses_normal_ht+0x12941, %rsi lea addresses_UC_ht+0x9dc1, %rdi nop nop nop nop nop and $51442, %r15 mov $76, %rcx rep movsq nop nop nop cmp %r8, %r8 lea addresses_A_ht+0x17cc2, %rax clflush (%rax) nop nop nop nop inc %r8 movups (%rax), %xmm1 vpextrq $1, %xmm1, %r11 dec %r15 lea addresses_WC_ht+0x1941a, %rsi lea addresses_WT_ht+0xae91, %rdi nop nop nop nop nop cmp $20706, %r15 mov $6, %rcx rep movsw nop nop xor %r11, %r11 lea addresses_UC_ht+0x1c311, %rcx clflush (%rcx) nop nop nop xor %rdx, %rdx movb (%rcx), %al mfence lea addresses_UC_ht+0x14a69, %r11 nop nop nop nop and $37950, %rax mov (%r11), %r8d nop nop inc %rsi lea addresses_D_ht+0x8511, %r8 nop and %rcx, %rcx mov (%r8), %r15 nop cmp %rdx, %rdx lea addresses_A_ht+0x1a7d9, %rdi nop dec %rsi mov (%rdi), %rdx inc %rax lea addresses_UC_ht+0x1a611, %rsi lea addresses_WC_ht+0x13f11, %rdi nop nop nop cmp $49936, %r8 mov $4, %rcx rep movsw nop nop nop nop mfence lea addresses_UC_ht+0x3a91, %rdi nop nop nop nop nop cmp $46873, %r15 mov $0x6162636465666768, %rax movq %rax, %xmm5 movups %xmm5, (%rdi) nop nop nop nop nop cmp $54240, %r8 lea addresses_A_ht+0xf099, %r8 nop nop cmp %rdx, %rdx vmovups (%r8), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rcx nop nop nop inc %rdi lea addresses_UC_ht+0xe111, %r11 nop nop nop nop add $21981, %rsi mov $0x6162636465666768, %r8 movq %r8, %xmm1 vmovups %ymm1, (%r11) and %rdi, %rdi lea addresses_UC_ht+0x12a31, %r11 cmp %rdx, %rdx movb $0x61, (%r11) nop nop nop nop dec %rax lea addresses_WT_ht+0x68b1, %rsi lea addresses_normal_ht+0x9cc1, %rdi nop nop nop inc %r11 mov $68, %rcx rep movsb nop nop cmp %rsi, %rsi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r8 push %rax push %rbp push %rbx // Store lea addresses_WT+0x1c311, %r13 nop nop nop nop cmp %rbx, %rbx movw $0x5152, (%r13) nop and $34366, %rax // Load lea addresses_A+0x8e91, %r12 inc %rbp mov (%r12), %r15w sub %r8, %r8 // Store lea addresses_WC+0x19b11, %rbp dec %r12 mov $0x5152535455565758, %r15 movq %r15, %xmm6 vmovntdq %ymm6, (%rbp) xor $16965, %r12 // Store lea addresses_WC+0x8911, %r13 nop nop xor $18158, %rax movl $0x51525354, (%r13) nop and $62699, %r13 // Store lea addresses_A+0x2d11, %rbp nop nop nop nop nop xor $35780, %r15 mov $0x5152535455565758, %r8 movq %r8, %xmm4 movups %xmm4, (%rbp) inc %r15 // Faulty Load lea addresses_WT+0x1b311, %rax clflush (%rax) nop nop nop nop nop add $64688, %rbp movb (%rax), %r12b lea oracles, %rbp and $0xff, %r12 shlq $12, %r12 mov (%rbp,%r12,1), %r12 pop %rbx pop %rbp pop %rax pop %r8 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WT', 'size': 2, 'AVXalign': False}} {'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': True, 'type': 'addresses_WC', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WC', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': True, 'congruent': 1, 'NT': False, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}} {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': True}} {'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False}} {'src': {'same': True, 'congruent': 3, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}} {'39': 373} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #include "olap/storage_engine.h" #include <sys/socket.h> #include <unistd.h> #include <cmath> #include <ctime> #include <string> #include <gperftools/profiler.h> #include "olap/cumulative_compaction.h" #include "olap/olap_common.h" #include "olap/olap_define.h" #include "olap/storage_engine.h" #include "agent/cgroups_mgr.h" using std::string; namespace doris { // number of running SCHEMA-CHANGE threads volatile uint32_t g_schema_change_active_threads = 0; OLAPStatus StorageEngine::_start_bg_worker() { _unused_rowset_monitor_thread = std::thread( [this] { _unused_rowset_monitor_thread_callback(nullptr); }); _unused_rowset_monitor_thread.detach(); // start thread for monitoring the snapshot and trash folder _garbage_sweeper_thread = std::thread( [this] { _garbage_sweeper_thread_callback(nullptr); }); _garbage_sweeper_thread.detach(); // start thread for monitoring the tablet with io error _disk_stat_monitor_thread = std::thread( [this] { _disk_stat_monitor_thread_callback(nullptr); }); _disk_stat_monitor_thread.detach(); // convert store map to vector std::vector<DataDir*> data_dirs; for (auto& tmp_store : _store_map) { data_dirs.push_back(tmp_store.second); } int32_t data_dir_num = data_dirs.size(); // base and cumulative compaction threads int32_t base_compaction_num_threads_per_disk = std::max<int32_t>(1, config::base_compaction_num_threads_per_disk); int32_t cumulative_compaction_num_threads_per_disk = std::max<int32_t>(1, config::cumulative_compaction_num_threads_per_disk); int32_t base_compaction_num_threads = base_compaction_num_threads_per_disk * data_dir_num; int32_t cumulative_compaction_num_threads = cumulative_compaction_num_threads_per_disk * data_dir_num; // calc the max concurrency of compaction tasks int32_t max_compaction_concurrency = config::max_compaction_concurrency; if (max_compaction_concurrency < 0 || max_compaction_concurrency > base_compaction_num_threads + cumulative_compaction_num_threads) { max_compaction_concurrency = base_compaction_num_threads + cumulative_compaction_num_threads; } Compaction::init(max_compaction_concurrency); _base_compaction_threads.reserve(base_compaction_num_threads); for (uint32_t i = 0; i < base_compaction_num_threads; ++i) { _base_compaction_threads.emplace_back( [this, data_dir_num, data_dirs, i] { _base_compaction_thread_callback(nullptr, data_dirs[i % data_dir_num]); }); } for (auto& thread : _base_compaction_threads) { thread.detach(); } _cumulative_compaction_threads.reserve(cumulative_compaction_num_threads); for (uint32_t i = 0; i < cumulative_compaction_num_threads; ++i) { _cumulative_compaction_threads.emplace_back( [this, data_dir_num, data_dirs, i] { _cumulative_compaction_thread_callback(nullptr, data_dirs[i % data_dir_num]); }); } for (auto& thread : _cumulative_compaction_threads) { thread.detach(); } // tablet checkpoint thread for (auto data_dir : data_dirs) { _tablet_checkpoint_threads.emplace_back( [this, data_dir] { _tablet_checkpoint_callback((void*)data_dir); }); } for (auto& thread : _tablet_checkpoint_threads) { thread.detach(); } // fd cache clean thread _fd_cache_clean_thread = std::thread( [this] { _fd_cache_clean_callback(nullptr); }); _fd_cache_clean_thread.detach(); // path scan and gc thread if (config::path_gc_check) { for (auto data_dir : get_stores()) { _path_scan_threads.emplace_back( [this, data_dir] { _path_scan_thread_callback((void*)data_dir); }); _path_gc_threads.emplace_back( [this, data_dir] { _path_gc_thread_callback((void*)data_dir); }); } for (auto& thread : _path_scan_threads) { thread.detach(); } for (auto& thread : _path_gc_threads) { thread.detach(); } } VLOG(10) << "init finished."; return OLAP_SUCCESS; } void* StorageEngine::_fd_cache_clean_callback(void* arg) { #ifdef GOOGLE_PROFILER ProfilerRegisterThread(); #endif uint32_t interval = config::file_descriptor_cache_clean_interval; if (interval <= 0) { OLAP_LOG_WARNING("config of file descriptor clean interval is illegal: [%d], " "force set to 3600", interval); interval = 3600; } while (true) { sleep(interval); start_clean_fd_cache(); } return nullptr; } void* StorageEngine::_base_compaction_thread_callback(void* arg, DataDir* data_dir) { #ifdef GOOGLE_PROFILER ProfilerRegisterThread(); #endif uint32_t interval = config::base_compaction_check_interval_seconds; if (interval <= 0) { OLAP_LOG_WARNING("base compaction check interval config is illegal: [%d], " "force set to 1", interval); interval = 1; } //string last_base_compaction_fs; //TTabletId last_base_compaction_tablet_id = -1; while (true) { // must be here, because this thread is start on start and // cgroup is not initialized at this time // add tid to cgroup CgroupsMgr::apply_system_cgroup(); if (!data_dir->reach_capacity_limit(0)) { perform_base_compaction(data_dir); } usleep(interval * 1000000); } return nullptr; } void* StorageEngine::_garbage_sweeper_thread_callback(void* arg) { #ifdef GOOGLE_PROFILER ProfilerRegisterThread(); #endif uint32_t max_interval = config::max_garbage_sweep_interval; uint32_t min_interval = config::min_garbage_sweep_interval; if (!(max_interval >= min_interval && min_interval > 0)) { OLAP_LOG_WARNING("garbage sweep interval config is illegal: [max=%d min=%d].", max_interval, min_interval); min_interval = 1; max_interval = max_interval >= min_interval ? max_interval : min_interval; LOG(INFO) << "force reset garbage sweep interval." << "max_interval" << max_interval << ", min_interval" << min_interval; } const double pi = 4 * std::atan(1); double usage = 1.0; // 程序启动后经过min_interval后触发第一轮扫描 while (true) { usage *= 100.0; // 该函数特性:当磁盘使用率<60%的时候,ratio接近于1; // 当使用率介于[60%, 75%]之间时,ratio急速从0.87降到0.27; // 当使用率大于75%时,ratio值开始缓慢下降 // 当usage=90%时,ratio约为0.0057 double ratio = (1.1 * (pi / 2 - std::atan(usage / 5 - 14)) - 0.28) / pi; ratio = ratio > 0 ? ratio : 0; uint32_t curr_interval = max_interval * ratio; // 此时的特性,当usage<60%时,curr_interval的时间接近max_interval, // 当usage > 80%时,curr_interval接近min_interval curr_interval = curr_interval > min_interval ? curr_interval : min_interval; sleep(curr_interval); // 开始清理,并得到清理后的磁盘使用率 OLAPStatus res = start_trash_sweep(&usage); if (res != OLAP_SUCCESS) { OLAP_LOG_WARNING("one or more errors occur when sweep trash." "see previous message for detail. [err code=%d]", res); // do nothing. continue next loop. } } return nullptr; } void* StorageEngine::_disk_stat_monitor_thread_callback(void* arg) { #ifdef GOOGLE_PROFILER ProfilerRegisterThread(); #endif uint32_t interval = config::disk_stat_monitor_interval; if (interval <= 0) { LOG(WARNING) << "disk_stat_monitor_interval config is illegal: " << interval << ", force set to 1"; interval = 1; } while (true) { start_disk_stat_monitor(); sleep(interval); } return nullptr; } void* StorageEngine::_cumulative_compaction_thread_callback(void* arg, DataDir* data_dir) { #ifdef GOOGLE_PROFILER ProfilerRegisterThread(); #endif LOG(INFO) << "try to start cumulative compaction process!"; uint32_t interval = config::cumulative_compaction_check_interval_seconds; if (interval <= 0) { LOG(WARNING) << "cumulative compaction check interval config is illegal:" << interval << "will be forced set to one"; interval = 1; } while (true) { // must be here, because this thread is start on start and // cgroup is not initialized at this time // add tid to cgroup CgroupsMgr::apply_system_cgroup(); if (!data_dir->reach_capacity_limit(0)) { perform_cumulative_compaction(data_dir); } usleep(interval * 1000000); } return nullptr; } void* StorageEngine::_unused_rowset_monitor_thread_callback(void* arg) { #ifdef GOOGLE_PROFILER ProfilerRegisterThread(); #endif uint32_t interval = config::unused_rowset_monitor_interval; if (interval <= 0) { LOG(WARNING) << "unused_rowset_monitor_interval config is illegal: " << interval << ", force set to 1"; interval = 1; } while (true) { start_delete_unused_rowset(); sleep(interval); } return nullptr; } } // namespace doris
/* * This is the predictor step for the MacCormack Algorithm. * * * Last Updated : 04/04/2018 * * Author(s) : Vivek Kumar */ // Add C++ includes #include <iostream> #include <fstream> #include <stdio.h> #include <cmath> #ifndef PREDICTOR #define PREDICTOR
; Copyright (c) 2004, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; WriteDr0.Asm ; ; Abstract: ; ; AsmWriteDr0 function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI ; AsmWriteDr0 ( ; IN UINTN Value ; ); ;------------------------------------------------------------------------------ AsmWriteDr0 PROC mov dr0, rcx mov rax, rcx ret AsmWriteDr0 ENDP END
; ----------------------------------------------------------------------------- ; Test for fmath functions under py65mon. ; Martin Heermance <mheermance@gmail.com> ; ----------------------------------------------------------------------------- .word $8000 .org $8000 .outfile "tests/fmath745Test.rom" .alias RamSize $7EFF ; default $8000 for 32 kb x 8 bit RAM .require "../../Common/data.asm" .advance $c000 .require "../fmath745.asm" ; Main entry point for the test main: ldx #SP0 ; Reset stack pointer `pushzero jsr mockConioInit .invoke pushi neg_pi .invoke pushi M_PI jsr fadd32 jsr fprintfpreg1 jsr fprintfpreg2 jsr printfloat `printcr .invoke pushi M_PI .invoke pushi M_PI jsr fsub32 jsr fprintfpreg1 jsr fprintfpreg2 jsr printfloat brk neg_two: .byte $c0,$00,$00,$00 neg_one: .byte $bf,$80,$00,$00 zero: .byte $00,$00,$00,$00 one_third: .byte $3e,$aa,$aa,$ab one: .byte $3f,$80,$00,$00 two: .byte $40,$00,$00,$00 infinity: .byte $7f,$80,$00,$00 neg_pi: .byte $c0,$49,$0f,$db .require "../../Common/tests/mockConio.asm" .require "../../Common/conio.asm" .require "../../Common/heap.asm" .require "../../Common/math16.asm" .require "../../Common/print.asm" .require "../../Common/stack.asm" .require "../../Common/string.asm" .require "../../Common/vectors.asm"
; A177145: E.g.f.: arcsin(x). ; 1,0,1,0,9,0,225,0,11025,0,893025,0,108056025,0,18261468225,0,4108830350625,0,1187451971330625,0 mov $1,4 mov $2,$0 mov $3,1 lpb $2,1 sub $2,$3 mul $1,$2 trn $2,1 lpe pow $1,2 div $1,16
xdef _GenDrawSpan xdef _RenderRotator WIDTH equ 160 HEIGHT equ 100 GROUPSIZE equ 32 section ".text" ; Texturing code inspired by article by Kalms ; https://amycoders.org/opt/innerloops.html GETUV macro move.w d1,d4 ; ----VVvv add.l d3,d1 move.b d0,d4 ; ----VVUU addx.b d2,d0 and.w d5,d4 ; [d5] $7ffe move.w d4,\1 endm GROUPLEN equ (4+4*GROUPSIZE) ; [d2] du ; [d3] dv _GenDrawSpan: movem.l d2-d7,-(sp) lea DrawSpanEnd(pc),a0 move.w #$7ffe,d5 clr.l d0 ; ------UU clr.l d1 ; uu--VVvv ; ----UUuu ; ----VVvv lsl.l #8,d2 ; --UUuu-- add.l d2,d2 ; lowest bit of UU is taken from fractional part! swap d3 ; VVvv---- move.w d2,d3 ; VVvvuu-- swap d3 ; uu--VVvv [d4] clr.w d2 ; --UU---- swap d2 ; ------UU [d3] move.l d3,d4 ; uu--VVvv clr.w d4 ; uu------ add.l d4,d1 ; init X-flag move.w #WIDTH/GROUPSIZE-1,d7 .loop32 lea -132(a0),a0 move.l a0,a1 swap d7 move.w #4-1,d7 .loop8 ; [a b c d e f g h] => [a b e f c d g h] GETUV 2(a1) GETUV 6(a1) GETUV 18(a1) GETUV 22(a1) GETUV 10(a1) GETUV 14(a1) GETUV 26(a1) GETUV 30(a1) lea 32(a1),a1 dbf d7,.loop8 swap d7 dbf d7,.loop32 movem.l (sp)+,d2-d7 rts ; [a0] chunky ; [a1] txtHi ; [a2] txtLo ; [d2] dU ; [d3] dV _RenderRotator: movem.l d2-d7/a2-a4,-(sp) lea WIDTH/2(a0),a0 ; the end of first line of chunky buffer swap d0 ; store vital state in upper part... swap d1 ; ...of data registers, for speed of course swap d2 swap d3 move.l a1,a3 ; txtHi move.l a2,a4 ; txtLo move.w #HEIGHT-1,d7 LoopY: swap d7 move.l d0,d4 move.l d1,d5 swap d4 ; tmpU swap d5 ; tmpV lsr.w #7,d4 ; tmpU >> 7 move.b d4,d5 ; (tmpV & 0xff00) | ((tmpU >> 7) & 0x00ff) and.w #$7ffe,d5 ; offset must be even and limited to 32767 lea (a3,d5.w),a1 lea (a4,d5.w),a2 FOURPIX macro move.w $1112(a1),\1 or.w $2222(a2),\1 move.b $3334(a1),\1 or.b $4444(a2),\1 endm ; GenDrawSpan precalculates offsets for instructions in FOURPIX rept WIDTH/GROUPSIZE FOURPIX d0 FOURPIX d1 FOURPIX d2 FOURPIX d3 FOURPIX d4 FOURPIX d5 FOURPIX d6 FOURPIX d7 movem.w d0-d7,-(a0) endr DrawSpanEnd: swap d7 lea WIDTH(a0),a0 ; move to the end of next line add.l d2,d0 ; lower part is always below 32768... add.l d3,d1 ; ... so it will not influence upper part dbf d7,LoopY movem.l (sp)+,d2-d7/a2-a4 rts
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php. ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; ReadMm3.Asm ; ; Abstract: ; ; AsmReadMm3 function ; ; Notes: ; ;------------------------------------------------------------------------------ .586 .model flat,C .mmx .code ;------------------------------------------------------------------------------ ; UINT64 ; EFIAPI ; AsmReadMm3 ( ; VOID ; ); ;------------------------------------------------------------------------------ AsmReadMm3 PROC push eax push eax movq [esp], mm3 pop eax pop edx ret AsmReadMm3 ENDP END
; A228546: x-values in the solution to the Pell equation x^2 - 74*y^2 = -1. ; Submitted by Jon Maiga ; 43,318157,2353725443,17412860509157,128820339693018043,953012855636086972957,7050388977175431732917843,52158776700130988324039229557,385870622977180074445810487344843,2854670816626401490619117661337918957,21118854315531495250420158012767437099043,156237281371631185236206838359335838320801157,1155843386468473192845962939762208519129849860443,8550929216856483309043248592153980265186790946756157,63259773190460877051828760238792206239643360294252189043 add $0,1 mul $0,2 mov $3,1 lpb $0 sub $0,1 add $2,$3 dif $2,2 mov $3,$1 mov $1,$2 mul $2,86 lpe mov $0,$1
; A142096: Primes congruent to 31 mod 35. ; Submitted by Jon Maiga ; 31,101,241,311,521,661,941,1151,1291,1361,1571,2131,2341,2411,2551,2621,2971,3041,3181,3251,3391,3461,3671,3881,4021,4091,4231,4441,4651,4721,4861,4931,5281,5351,5701,5981,6121,6961,7451,7591,8011,8081,8221,8291,8431,8501,8641,9341,9551,9901,10111,10181,10321,10391,10531,10601,11161,12071,12211,12281,12421,12491,12841,12911,13121,13331,13681,13751,14591,14731,15361,15641,15991,16061,16411,16481,16691,16831,16901,17041,17321,17881,18301,18371,19001,19141,19211,19421,19841,20051,20261,20611,20681 mov $1,15 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,2 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,35 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 sub $0,50 mul $0,2 add $0,31
; ; written by Benjamin Green, adapting code from Waleed Hasan ; ; $Id: DsClearScreen.asm,v 1.4 2015/01/19 01:33:06 pauloscustodio Exp $ ; PUBLIC DsClearScreen .DsClearScreen ; in a,(3) ; ld l,a ; in a,(4) ; ld h,a ; push hl ld a,$10 out (4),a xor a out (3),a ld de,$A001 ld h,d ld l,a ld bc,30*120-1 ld (hl),a ldir ; pop hl ; ld a,l ; out (3),a ; ld a,h ; out (4),a ret
; A346879: Sum of the divisors, except the smallest and the largest, of the n-th odd number. ; 0,0,0,0,3,0,0,8,0,0,10,0,5,12,0,0,14,12,0,16,0,0,32,0,7,20,0,16,22,0,0,40,18,0,26,0,0,48,18,0,39,0,22,32,0,20,34,24,0,56,0,0,86,0,0,40,0,28,64,24,11,44,30,0,46,0,26,104,0,0,50,24,34,80,0,0,80,36 mov $2,$0 add $0,1 lpb $0 max $0,3 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 add $1,$3 add $2,1 lpe mov $0,$1
// Inline Strings in method calls are automatically converted to local constant variables byte st[] = "..."; - generating an ASM .text). // Commodore 64 PRG executable file .file [name="inline-string.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .label screen = 4 .segment Code main: { // print(msg1) lda #<$400 sta.z screen lda #>$400 sta.z screen+1 lda #<msg1 sta.z print.msg lda #>msg1 sta.z print.msg+1 jsr print // print(msg2) lda #<msg2 sta.z print.msg lda #>msg2 sta.z print.msg+1 jsr print // print("message 3 ") lda #<msg sta.z print.msg lda #>msg sta.z print.msg+1 jsr print // } rts .segment Data msg2: .text "message 2 " .byte 0 msg: .text "message 3 " .byte 0 } .segment Code // void print(__zp(2) char *msg) print: { .label msg = 2 __b1: // while(*msg) ldy #0 lda (msg),y cmp #0 bne __b2 // } rts __b2: // *(screen++) = *(msg++) ldy #0 lda (msg),y sta (screen),y // *(screen++) = *(msg++); inc.z screen bne !+ inc.z screen+1 !: inc.z msg bne !+ inc.z msg+1 !: jmp __b1 } .segment Data msg1: .text "message 1 " .byte 0
; A069477: a(n) = 60*n^2 + 180*n + 150. ; 390,750,1230,1830,2550,3390,4350,5430,6630,7950,9390,10950,12630,14430,16350,18390,20550,22830,25230,27750,30390,33150,36030,39030,42150,45390,48750,52230,55830,59550,63390,67350,71430,75630,79950,84390,88950,93630,98430,103350,108390,113550,118830,124230,129750,135390,141150,147030,153030,159150,165390,171750,178230,184830,191550,198390,205350,212430,219630,226950,234390,241950,249630,257430,265350,273390,281550,289830,298230,306750,315390,324150,333030,342030,351150,360390,369750,379230,388830,398550,408390,418350,428430,438630,448950,459390,469950,480630,491430,502350,513390,524550,535830,547230,558750,570390,582150,594030,606030,618150 mov $1,$0 add $0,5 mul $1,2 mul $0,$1 add $0,13 mul $0,30
.text .abicalls .section .mdebug.abi32,"",@progbits .nan legacy .file "h264ref.memalloc.no_mem_exit.ll" .text .globl no_mem_exit .align 2 .type no_mem_exit,@function .set nomicromips .set nomips16 .ent no_mem_exit no_mem_exit: # @no_mem_exit .frame $sp,32,$ra .mask 0x80030000,-4 .fmask 0x00000000,0 .set noreorder .set nomacro .set noat # BB#0: lui $2, %hi(_gp_disp) addiu $2, $2, %lo(_gp_disp) addiu $sp, $sp, -32 sw $ra, 28($sp) # 4-byte Folded Spill sw $17, 24($sp) # 4-byte Folded Spill sw $16, 20($sp) # 4-byte Folded Spill addu $16, $2, $25 move $1, $4 lw $17, %got(errortext)($16) lw $6, %got(.str.20)($16) lw $25, %call16(snprintf)($16) move $4, $17 addiu $5, $zero, 300 move $7, $1 jalr $25 move $gp, $16 lw $25, %call16(error)($16) move $4, $17 addiu $5, $zero, 100 jalr $25 move $gp, $16 lw $16, 20($sp) # 4-byte Folded Reload lw $17, 24($sp) # 4-byte Folded Reload lw $ra, 28($sp) # 4-byte Folded Reload jr $ra addiu $sp, $sp, 32 .set at .set macro .set reorder .end no_mem_exit $func_end0: .size no_mem_exit, ($func_end0)-no_mem_exit .hidden .str.20 .ident "clang version 3.8.0 (http://llvm.org/git/clang.git 2d49f0a0ae8366964a93e3b7b26e29679bee7160) (http://llvm.org/git/llvm.git 60bc66b44837125843b58ed3e0fd2e6bb948d839)" .section ".note.GNU-stack","",@progbits .text
; A317203: Fixed under the morphism 1 -> 132, 2 -> 1, 3 -> 3, starting with 31. ; 3,1,3,2,3,1,3,1,3,2,3,1,3,2,3,1,3,1,3,2,3,1,3,1,3,2,3,1,3,2,3,1,3,1,3,2,3,1,3,2,3,1,3,1,3,2,3,1,3,1,3,2,3,1,3,2,3,1,3,1,3,2,3,1,3,1,3,2,3,1,3,2,3,1,3,1,3,2,3,1,3,2,3,1,3,1,3,2,3,1,3,1,3,2,3,1,3,2,3,1 add $0,2 seq $0,108103 ; Fixed point of the square of the morphism: 1->3, 2->1, 3->121, starting with 1. sub $2,$0 mov $0,$2 add $0,4
; A330801: a(n) = A080247(2*n, n), the central values of the Big-Schröder triangle. ; Submitted by Jon Maiga ; 1,4,30,264,2490,24396,244790,2496528,25763058,268243860,2812481870,29653804824,314097641130,3339741725404,35626286189670,381098437754912,4086504567333858,43912100376527652,472743964145437310,5097853987059017000,55054474579787825562 mov $1,1 add $1,$0 seq $0,27307 ; Number of paths from (0,0) to (3n,0) that stay in first quadrant (but may touch horizontal axis) and where each step is (2,1), (1,2) or (1,-1). mul $0,$1
db 0 ; 417 DEX NO db 60, 45, 70, 95, 45, 90 ; hp atk def spd sat sdf db ELECTRIC, ELECTRIC ; type db 200 ; catch rate db 120 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 100 ; unknown 1 db 10 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/sinnoh/pachirisu/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_FAST ; growth rate dn EGG_GROUND, EGG_FAIRY ; egg groups ; tm/hm learnset tmhm ; end
/****************************************************************************** * * Project: ODS Translator * Purpose: Implements OGRODSDriver. * Author: Even Rouault, even dot rouault at mines dash paris dot org * ****************************************************************************** * Copyright (c) 2012, Even Rouault <even dot rouault at mines-paris dot org> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "cpl_conv.h" #include "ogr_ods.h" #include "ogrsf_frmts.h" CPL_CVSID("$Id$"); using namespace OGRODS; // g++ -DHAVE_EXPAT -g -Wall -fPIC ogr/ogrsf_frmts/ods/*.cpp -shared // -o ogr_ODS.so -Iport -Igcore -Iogr -Iogr/ogrsf_frmts // -Iogr/ogrsf_frmts/mem -Iogr/ogrsf_frmts/ods -L. -lgdal /************************************************************************/ /* ~OGRODSDriver() */ /************************************************************************/ OGRODSDriver::~OGRODSDriver() {} /************************************************************************/ /* GetName() */ /************************************************************************/ const char *OGRODSDriver::GetName() { return "ODS"; } /************************************************************************/ /* Open() */ /************************************************************************/ OGRDataSource *OGRODSDriver::Open( const char * pszFilename, int bUpdate ) { CPLString osContentFilename; const char* pszContentFilename = pszFilename; VSILFILE* fpContent = NULL; VSILFILE* fpSettings = NULL; if (EQUAL(CPLGetExtension(pszFilename), "ODS")) { VSILFILE* fp = VSIFOpenL(pszFilename, "rb"); if (fp == NULL) return NULL; bool bOK = false; char szBuffer[1024]; if( VSIFReadL(szBuffer, sizeof(szBuffer), 1, fp) == 1 && memcmp(szBuffer, "PK", 2) == 0 ) { bOK = true; } VSIFCloseL(fp); if (!bOK) return NULL; osContentFilename.Printf("/vsizip/%s/content.xml", pszFilename); pszContentFilename = osContentFilename.c_str(); } else if (bUpdate) /* We cannot update the xml file, only the .ods */ { return NULL; } if (STARTS_WITH_CI(pszContentFilename, "ODS:") || EQUAL(CPLGetFilename(pszContentFilename), "content.xml")) { if (STARTS_WITH_CI(pszContentFilename, "ODS:")) pszContentFilename += 4; fpContent = VSIFOpenL(pszContentFilename, "rb"); if (fpContent == NULL) return NULL; char szBuffer[1024]; int nRead = (int)VSIFReadL(szBuffer, 1, sizeof(szBuffer) - 1, fpContent); szBuffer[nRead] = 0; if (strstr(szBuffer, "<office:document-content") == NULL) { VSIFCloseL(fpContent); return NULL; } /* We could also check that there's a <office:spreadsheet>, but it might be further */ /* in the XML due to styles, etc... */ } else { return NULL; } if (EQUAL(CPLGetExtension(pszFilename), "ODS")) { fpSettings = VSIFOpenL(CPLSPrintf("/vsizip/%s/settings.xml", pszFilename), "rb"); } OGRODSDataSource *poDS = new OGRODSDataSource(); if( !poDS->Open( pszFilename, fpContent, fpSettings, bUpdate ) ) { delete poDS; poDS = NULL; } return poDS; } /************************************************************************/ /* CreateDataSource() */ /************************************************************************/ OGRDataSource *OGRODSDriver::CreateDataSource( const char * pszName, char **papszOptions ) { if (!EQUAL(CPLGetExtension(pszName), "ODS")) { CPLError( CE_Failure, CPLE_AppDefined, "File extension should be ODS" ); return NULL; } /* -------------------------------------------------------------------- */ /* First, ensure there isn't any such file yet. */ /* -------------------------------------------------------------------- */ VSIStatBufL sStatBuf; if( VSIStatL( pszName, &sStatBuf ) == 0 ) { CPLError( CE_Failure, CPLE_AppDefined, "It seems a file system object called '%s' already exists.", pszName ); return NULL; } /* -------------------------------------------------------------------- */ /* Try to create datasource. */ /* -------------------------------------------------------------------- */ OGRODSDataSource *poDS = new OGRODSDataSource(); if( !poDS->Create( pszName, papszOptions ) ) { delete poDS; return NULL; } return poDS; } /************************************************************************/ /* DeleteDataSource() */ /************************************************************************/ OGRErr OGRODSDriver::DeleteDataSource( const char *pszName ) { if (VSIUnlink( pszName ) == 0) return OGRERR_NONE; return OGRERR_FAILURE; } /************************************************************************/ /* TestCapability() */ /************************************************************************/ int OGRODSDriver::TestCapability( const char *pszCap ) { if( EQUAL(pszCap,ODrCCreateDataSource) ) return TRUE; if( EQUAL(pszCap,ODrCDeleteDataSource) ) return TRUE; return FALSE; } /************************************************************************/ /* RegisterOGRODS() */ /************************************************************************/ void RegisterOGRODS() { OGRSFDriver* poDriver = new OGRODSDriver; poDriver->SetMetadataItem( GDAL_DMD_LONGNAME, "Open Document/ LibreOffice / " "OpenOffice Spreadsheet " ); poDriver->SetMetadataItem( GDAL_DMD_EXTENSION, "ods" ); poDriver->SetMetadataItem( GDAL_DMD_HELPTOPIC, "drv_ods.html" ); poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" ); poDriver->SetMetadataItem( GDAL_DMD_CREATIONFIELDDATATYPES, "Integer Integer64 Real String Date DateTime " "Time Binary" ); OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver( poDriver ); }
; Original address was $AB8D ; Empty/unused .word W701L ; Alternate level layout .word W701O ; Alternate object layout .byte LEVEL1_SIZE_08 | LEVEL1_YSTART_040 .byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 .byte LEVEL3_TILESET_01 | LEVEL3_VSCROLL_LOCKLOW | LEVEL3_PIPENOTEXIT .byte LEVEL4_BGBANK_INDEX(6) | LEVEL4_INITACT_NOTHING .byte LEVEL5_BGM_UNDERWATER | LEVEL5_TIME_300 .byte $FF
code proc UI_RemoveBotsMenu_SetBotNames 1032 12 ADDRLP4 0 CNSTI4 0 ASGNI4 ADDRGP4 $73 JUMPV LABELV $70 ADDRGP4 removeBotsMenuInfo+1396 INDIRI4 ADDRLP4 0 INDIRI4 ADDI4 CNSTI4 2 LSHI4 ADDRGP4 removeBotsMenuInfo+1628 ADDP4 INDIRI4 CNSTI4 544 ADDI4 ARGI4 ADDRLP4 4 ARGP4 CNSTI4 1024 ARGI4 ADDRGP4 trap_GetConfigString CALLI4 pop ADDRLP4 4 ARGP4 ADDRGP4 $79 ARGP4 ADDRLP4 1028 ADDRGP4 Info_ValueForKey CALLP4 ASGNP4 ADDRLP4 0 INDIRI4 CNSTI4 5 LSHI4 ADDRGP4 removeBotsMenuInfo+1404 ADDP4 ARGP4 ADDRLP4 1028 INDIRP4 ARGP4 CNSTI4 32 ARGI4 ADDRGP4 Q_strncpyz CALLV pop ADDRLP4 0 INDIRI4 CNSTI4 5 LSHI4 ADDRGP4 removeBotsMenuInfo+1404 ADDP4 ARGP4 ADDRGP4 Q_CleanStr CALLP4 pop LABELV $71 ADDRLP4 0 ADDRLP4 0 INDIRI4 CNSTI4 1 ADDI4 ASGNI4 LABELV $73 ADDRLP4 0 INDIRI4 CNSTI4 7 GEI4 $82 ADDRGP4 removeBotsMenuInfo+1396 INDIRI4 ADDRLP4 0 INDIRI4 ADDI4 ADDRGP4 removeBotsMenuInfo+1392 INDIRI4 LTI4 $70 LABELV $82 LABELV $69 endproc UI_RemoveBotsMenu_SetBotNames 1032 12 proc UI_RemoveBotsMenu_DeleteEvent 4 8 ADDRFP4 4 INDIRI4 CNSTI4 3 EQI4 $84 ADDRGP4 $83 JUMPV LABELV $84 ADDRGP4 $86 ARGP4 ADDRGP4 removeBotsMenuInfo+1396 INDIRI4 ADDRGP4 removeBotsMenuInfo+1400 INDIRI4 ADDI4 CNSTI4 2 LSHI4 ADDRGP4 removeBotsMenuInfo+1628 ADDP4 INDIRI4 ARGI4 ADDRLP4 0 ADDRGP4 va CALLP4 ASGNP4 CNSTI4 2 ARGI4 ADDRLP4 0 INDIRP4 ARGP4 ADDRGP4 trap_Cmd_ExecuteText CALLV pop LABELV $83 endproc UI_RemoveBotsMenu_DeleteEvent 4 8 proc UI_RemoveBotsMenu_BotEvent 0 0 ADDRFP4 4 INDIRI4 CNSTI4 3 EQI4 $91 ADDRGP4 $90 JUMPV LABELV $91 CNSTI4 72 ADDRGP4 removeBotsMenuInfo+1400 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+68 ADDP4 ADDRGP4 color_orange ASGNP4 ADDRGP4 removeBotsMenuInfo+1400 ADDRFP4 0 INDIRP4 CNSTI4 8 ADDP4 INDIRI4 CNSTI4 20 SUBI4 ASGNI4 CNSTI4 72 ADDRGP4 removeBotsMenuInfo+1400 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+68 ADDP4 ADDRGP4 color_white ASGNP4 LABELV $90 endproc UI_RemoveBotsMenu_BotEvent 0 0 proc UI_RemoveBotsMenu_BackEvent 0 0 ADDRFP4 4 INDIRI4 CNSTI4 3 EQI4 $101 ADDRGP4 $100 JUMPV LABELV $101 ADDRGP4 UI_PopMenu CALLV pop LABELV $100 endproc UI_RemoveBotsMenu_BackEvent 0 0 proc UI_RemoveBotsMenu_UpEvent 4 0 ADDRFP4 4 INDIRI4 CNSTI4 3 EQI4 $104 ADDRGP4 $103 JUMPV LABELV $104 ADDRGP4 removeBotsMenuInfo+1396 INDIRI4 CNSTI4 0 LEI4 $106 ADDRLP4 0 ADDRGP4 removeBotsMenuInfo+1396 ASGNP4 ADDRLP4 0 INDIRP4 ADDRLP4 0 INDIRP4 INDIRI4 CNSTI4 1 SUBI4 ASGNI4 ADDRGP4 UI_RemoveBotsMenu_SetBotNames CALLV pop LABELV $106 LABELV $103 endproc UI_RemoveBotsMenu_UpEvent 4 0 proc UI_RemoveBotsMenu_DownEvent 4 0 ADDRFP4 4 INDIRI4 CNSTI4 3 EQI4 $111 ADDRGP4 $110 JUMPV LABELV $111 ADDRGP4 removeBotsMenuInfo+1396 INDIRI4 CNSTI4 7 ADDI4 ADDRGP4 removeBotsMenuInfo+1392 INDIRI4 GEI4 $113 ADDRLP4 0 ADDRGP4 removeBotsMenuInfo+1396 ASGNP4 ADDRLP4 0 INDIRP4 ADDRLP4 0 INDIRP4 INDIRI4 CNSTI4 1 ADDI4 ASGNI4 ADDRGP4 UI_RemoveBotsMenu_SetBotNames CALLV pop LABELV $113 LABELV $110 endproc UI_RemoveBotsMenu_DownEvent 4 0 proc UI_RemoveBotsMenu_GetBots 1056 12 CNSTI4 0 ARGI4 ADDRLP4 4 ARGP4 CNSTI4 1024 ARGI4 ADDRGP4 trap_GetConfigString CALLI4 pop ADDRLP4 4 ARGP4 ADDRGP4 $119 ARGP4 ADDRLP4 1036 ADDRGP4 Info_ValueForKey CALLP4 ASGNP4 ADDRLP4 1036 INDIRP4 ARGP4 ADDRLP4 1040 ADDRGP4 qk_atoi CALLI4 ASGNI4 ADDRLP4 1032 ADDRLP4 1040 INDIRI4 ASGNI4 ADDRGP4 removeBotsMenuInfo+1392 CNSTI4 0 ASGNI4 ADDRLP4 0 CNSTI4 0 ASGNI4 ADDRGP4 $124 JUMPV LABELV $121 ADDRLP4 0 INDIRI4 CNSTI4 544 ADDI4 ARGI4 ADDRLP4 4 ARGP4 CNSTI4 1024 ARGI4 ADDRGP4 trap_GetConfigString CALLI4 pop ADDRLP4 4 ARGP4 ADDRGP4 $125 ARGP4 ADDRLP4 1044 ADDRGP4 Info_ValueForKey CALLP4 ASGNP4 ADDRLP4 1044 INDIRP4 ARGP4 ADDRLP4 1048 ADDRGP4 qk_atoi CALLI4 ASGNI4 ADDRLP4 1028 ADDRLP4 1048 INDIRI4 ASGNI4 ADDRLP4 1028 INDIRI4 CNSTI4 0 NEI4 $126 ADDRGP4 $122 JUMPV LABELV $126 ADDRGP4 removeBotsMenuInfo+1392 INDIRI4 CNSTI4 2 LSHI4 ADDRGP4 removeBotsMenuInfo+1628 ADDP4 ADDRLP4 0 INDIRI4 ASGNI4 ADDRLP4 1052 ADDRGP4 removeBotsMenuInfo+1392 ASGNP4 ADDRLP4 1052 INDIRP4 ADDRLP4 1052 INDIRP4 INDIRI4 CNSTI4 1 ADDI4 ASGNI4 LABELV $122 ADDRLP4 0 ADDRLP4 0 INDIRI4 CNSTI4 1 ADDI4 ASGNI4 LABELV $124 ADDRLP4 0 INDIRI4 ADDRLP4 1032 INDIRI4 LTI4 $121 LABELV $118 endproc UI_RemoveBotsMenu_GetBots 1056 12 export UI_RemoveBots_Cache proc UI_RemoveBots_Cache 0 4 ADDRGP4 $132 ARGP4 ADDRGP4 trap_R_RegisterShaderNoMip CALLI4 pop ADDRGP4 $133 ARGP4 ADDRGP4 trap_R_RegisterShaderNoMip CALLI4 pop ADDRGP4 $134 ARGP4 ADDRGP4 trap_R_RegisterShaderNoMip CALLI4 pop ADDRGP4 $135 ARGP4 ADDRGP4 trap_R_RegisterShaderNoMip CALLI4 pop ADDRGP4 $136 ARGP4 ADDRGP4 trap_R_RegisterShaderNoMip CALLI4 pop LABELV $131 endproc UI_RemoveBots_Cache 0 4 proc UI_RemoveBotsMenu_Init 24 12 ADDRGP4 removeBotsMenuInfo ARGP4 CNSTI4 0 ARGI4 CNSTU4 5724 ARGU4 ADDRGP4 qk_memset CALLP4 pop ADDRGP4 removeBotsMenuInfo+280 CNSTI4 0 ASGNI4 ADDRGP4 removeBotsMenuInfo+276 CNSTI4 1 ASGNI4 ADDRGP4 UI_RemoveBots_Cache CALLV pop ADDRGP4 UI_RemoveBotsMenu_GetBots CALLV pop ADDRGP4 UI_RemoveBotsMenu_SetBotNames CALLV pop ADDRGP4 removeBotsMenuInfo+1392 INDIRI4 CNSTI4 7 GEI4 $143 ADDRLP4 12 ADDRGP4 removeBotsMenuInfo+1392 INDIRI4 ASGNI4 ADDRGP4 $144 JUMPV LABELV $143 ADDRLP4 12 CNSTI4 7 ASGNI4 LABELV $144 ADDRLP4 4 ADDRLP4 12 INDIRI4 ASGNI4 ADDRGP4 removeBotsMenuInfo+288 CNSTI4 10 ASGNI4 ADDRGP4 removeBotsMenuInfo+288+12 CNSTI4 320 ASGNI4 ADDRGP4 removeBotsMenuInfo+288+16 CNSTI4 16 ASGNI4 ADDRGP4 removeBotsMenuInfo+288+60 ADDRGP4 $152 ASGNP4 ADDRGP4 removeBotsMenuInfo+288+68 ADDRGP4 color_white ASGNP4 ADDRGP4 removeBotsMenuInfo+288+64 CNSTI4 1 ASGNI4 ADDRGP4 removeBotsMenuInfo+360 CNSTI4 6 ASGNI4 ADDRGP4 removeBotsMenuInfo+360+4 ADDRGP4 $132 ASGNP4 ADDRGP4 removeBotsMenuInfo+360+44 CNSTU4 16384 ASGNU4 ADDRGP4 removeBotsMenuInfo+360+12 CNSTI4 87 ASGNI4 ADDRGP4 removeBotsMenuInfo+360+16 CNSTI4 74 ASGNI4 ADDRGP4 removeBotsMenuInfo+360+76 CNSTI4 466 ASGNI4 ADDRGP4 removeBotsMenuInfo+360+80 CNSTI4 332 ASGNI4 ADDRGP4 removeBotsMenuInfo+448 CNSTI4 6 ASGNI4 ADDRGP4 removeBotsMenuInfo+448+4 ADDRGP4 $173 ASGNP4 ADDRGP4 removeBotsMenuInfo+448+44 CNSTU4 16384 ASGNU4 ADDRGP4 removeBotsMenuInfo+448+12 CNSTI4 200 ASGNI4 ADDRGP4 removeBotsMenuInfo+448+16 CNSTI4 128 ASGNI4 ADDRGP4 removeBotsMenuInfo+448+76 CNSTI4 64 ASGNI4 ADDRGP4 removeBotsMenuInfo+448+80 CNSTI4 128 ASGNI4 ADDRGP4 removeBotsMenuInfo+536 CNSTI4 6 ASGNI4 ADDRGP4 removeBotsMenuInfo+536+44 CNSTU4 260 ASGNU4 ADDRGP4 removeBotsMenuInfo+536+12 CNSTI4 200 ASGNI4 ADDRGP4 removeBotsMenuInfo+536+16 CNSTI4 128 ASGNI4 ADDRGP4 removeBotsMenuInfo+536+8 CNSTI4 10 ASGNI4 ADDRGP4 removeBotsMenuInfo+536+48 ADDRGP4 UI_RemoveBotsMenu_UpEvent ASGNP4 ADDRGP4 removeBotsMenuInfo+536+76 CNSTI4 64 ASGNI4 ADDRGP4 removeBotsMenuInfo+536+80 CNSTI4 64 ASGNI4 ADDRGP4 removeBotsMenuInfo+536+60 ADDRGP4 $201 ASGNP4 ADDRGP4 removeBotsMenuInfo+624 CNSTI4 6 ASGNI4 ADDRGP4 removeBotsMenuInfo+624+44 CNSTU4 260 ASGNU4 ADDRGP4 removeBotsMenuInfo+624+12 CNSTI4 200 ASGNI4 ADDRGP4 removeBotsMenuInfo+624+16 CNSTI4 192 ASGNI4 ADDRGP4 removeBotsMenuInfo+624+8 CNSTI4 11 ASGNI4 ADDRGP4 removeBotsMenuInfo+624+48 ADDRGP4 UI_RemoveBotsMenu_DownEvent ASGNP4 ADDRGP4 removeBotsMenuInfo+624+76 CNSTI4 64 ASGNI4 ADDRGP4 removeBotsMenuInfo+624+80 CNSTI4 64 ASGNI4 ADDRGP4 removeBotsMenuInfo+624+60 ADDRGP4 $219 ASGNP4 ADDRLP4 0 CNSTI4 0 ASGNI4 ADDRLP4 8 CNSTI4 120 ASGNI4 ADDRGP4 $223 JUMPV LABELV $220 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712 ADDP4 CNSTI4 9 ASGNI4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+44 ADDP4 CNSTU4 260 ASGNU4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+8 ADDP4 ADDRLP4 0 INDIRI4 CNSTI4 20 ADDI4 ASGNI4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+12 ADDP4 CNSTI4 264 ASGNI4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+16 ADDP4 ADDRLP4 8 INDIRI4 ASGNI4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+48 ADDP4 ADDRGP4 UI_RemoveBotsMenu_BotEvent ASGNP4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+60 ADDP4 ADDRLP4 0 INDIRI4 CNSTI4 5 LSHI4 ADDRGP4 removeBotsMenuInfo+1404 ADDP4 ASGNP4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+68 ADDP4 ADDRGP4 color_orange ASGNP4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712+64 ADDP4 CNSTI4 16 ASGNI4 LABELV $221 ADDRLP4 0 ADDRLP4 0 INDIRI4 CNSTI4 1 ADDI4 ASGNI4 ADDRLP4 8 ADDRLP4 8 INDIRI4 CNSTI4 20 ADDI4 ASGNI4 LABELV $223 ADDRLP4 0 INDIRI4 ADDRLP4 4 INDIRI4 LTI4 $220 ADDRGP4 removeBotsMenuInfo+1216 CNSTI4 6 ASGNI4 ADDRGP4 removeBotsMenuInfo+1216+4 ADDRGP4 $135 ASGNP4 ADDRGP4 removeBotsMenuInfo+1216+44 CNSTU4 260 ASGNU4 ADDRGP4 removeBotsMenuInfo+1216+8 CNSTI4 12 ASGNI4 ADDRGP4 removeBotsMenuInfo+1216+48 ADDRGP4 UI_RemoveBotsMenu_DeleteEvent ASGNP4 ADDRGP4 removeBotsMenuInfo+1216+12 CNSTI4 320 ASGNI4 ADDRGP4 removeBotsMenuInfo+1216+16 CNSTI4 320 ASGNI4 ADDRGP4 removeBotsMenuInfo+1216+76 CNSTI4 128 ASGNI4 ADDRGP4 removeBotsMenuInfo+1216+80 CNSTI4 64 ASGNI4 ADDRGP4 removeBotsMenuInfo+1216+60 ADDRGP4 $136 ASGNP4 ADDRGP4 removeBotsMenuInfo+1304 CNSTI4 6 ASGNI4 ADDRGP4 removeBotsMenuInfo+1304+4 ADDRGP4 $133 ASGNP4 ADDRGP4 removeBotsMenuInfo+1304+44 CNSTU4 260 ASGNU4 ADDRGP4 removeBotsMenuInfo+1304+8 CNSTI4 13 ASGNI4 ADDRGP4 removeBotsMenuInfo+1304+48 ADDRGP4 UI_RemoveBotsMenu_BackEvent ASGNP4 ADDRGP4 removeBotsMenuInfo+1304+12 CNSTI4 192 ASGNI4 ADDRGP4 removeBotsMenuInfo+1304+16 CNSTI4 320 ASGNI4 ADDRGP4 removeBotsMenuInfo+1304+76 CNSTI4 128 ASGNI4 ADDRGP4 removeBotsMenuInfo+1304+80 CNSTI4 64 ASGNI4 ADDRGP4 removeBotsMenuInfo+1304+60 ADDRGP4 $134 ASGNP4 ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 removeBotsMenuInfo+360 ARGP4 ADDRGP4 Menu_AddItem CALLV pop ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 removeBotsMenuInfo+288 ARGP4 ADDRGP4 Menu_AddItem CALLV pop ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 removeBotsMenuInfo+448 ARGP4 ADDRGP4 Menu_AddItem CALLV pop ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 removeBotsMenuInfo+536 ARGP4 ADDRGP4 Menu_AddItem CALLV pop ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 removeBotsMenuInfo+624 ARGP4 ADDRGP4 Menu_AddItem CALLV pop ADDRLP4 0 CNSTI4 0 ASGNI4 ADDRGP4 $288 JUMPV LABELV $285 ADDRGP4 removeBotsMenuInfo ARGP4 CNSTI4 72 ADDRLP4 0 INDIRI4 MULI4 ADDRGP4 removeBotsMenuInfo+712 ADDP4 ARGP4 ADDRGP4 Menu_AddItem CALLV pop LABELV $286 ADDRLP4 0 ADDRLP4 0 INDIRI4 CNSTI4 1 ADDI4 ASGNI4 LABELV $288 ADDRLP4 0 INDIRI4 ADDRLP4 4 INDIRI4 LTI4 $285 ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 removeBotsMenuInfo+1216 ARGP4 ADDRGP4 Menu_AddItem CALLV pop ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 removeBotsMenuInfo+1304 ARGP4 ADDRGP4 Menu_AddItem CALLV pop ADDRGP4 removeBotsMenuInfo+1396 CNSTI4 0 ASGNI4 ADDRGP4 removeBotsMenuInfo+1400 CNSTI4 0 ASGNI4 ADDRGP4 removeBotsMenuInfo+712+68 ADDRGP4 color_white ASGNP4 LABELV $137 endproc UI_RemoveBotsMenu_Init 24 12 export UI_RemoveBotsMenu proc UI_RemoveBotsMenu 0 4 ADDRGP4 UI_RemoveBotsMenu_Init CALLV pop ADDRGP4 removeBotsMenuInfo ARGP4 ADDRGP4 UI_PushMenu CALLV pop LABELV $296 endproc UI_RemoveBotsMenu 0 4 bss align 4 LABELV removeBotsMenuInfo skip 5724 import UI_RankStatusMenu import RankStatus_Cache import UI_SignupMenu import Signup_Cache import UI_LoginMenu import Login_Cache import UI_RankingsMenu import Rankings_Cache import Rankings_DrawPassword import Rankings_DrawName import Rankings_DrawText import UI_InitGameinfo import UI_SPUnlockMedals_f import UI_SPUnlock_f import UI_GetAwardLevel import UI_LogAwardData import UI_NewGame import UI_GetCurrentGame import UI_CanShowTierVideo import UI_ShowTierVideo import UI_TierCompleted import UI_SetBestScore import UI_GetBestScore import UI_GetNumBots import UI_GetBotInfoByName import UI_GetBotInfoByNumber import UI_GetNumSPTiers import UI_GetNumSPArenas import UI_GetNumArenas import UI_GetSpecialArenaInfo import UI_GetArenaInfoByMap import UI_GetArenaInfoByNumber import UI_NetworkOptionsMenu import UI_NetworkOptionsMenu_Cache import UI_SoundOptionsMenu import UI_SoundOptionsMenu_Cache import UI_DisplayOptionsMenu import UI_DisplayOptionsMenu_Cache import UI_SaveConfigMenu import UI_SaveConfigMenu_Cache import UI_LoadConfigMenu import UI_LoadConfig_Cache import UI_TeamOrdersMenu_Cache import UI_TeamOrdersMenu_f import UI_TeamOrdersMenu import UI_AddBotsMenu import UI_AddBots_Cache import trap_SetPbClStatus import trap_VerifyCDKey import trap_SetCDKey import trap_GetCDKey import trap_MemoryRemaining import trap_LAN_GetPingInfo import trap_LAN_GetPing import trap_LAN_ClearPing import trap_LAN_ServerStatus import trap_LAN_GetPingQueueCount import trap_LAN_GetServerInfo import trap_LAN_GetServerAddressString import trap_LAN_GetServerCount import trap_GetConfigString import trap_GetGlconfig import trap_GetClientState import trap_GetClipboardData import trap_Key_SetCatcher import trap_Key_GetCatcher import trap_Key_ClearStates import trap_Key_SetOverstrikeMode import trap_Key_GetOverstrikeMode import trap_Key_IsDown import trap_Key_SetBinding import trap_Key_GetBindingBuf import trap_Key_KeynumToStringBuf import trap_S_RegisterSound import trap_S_StartLocalSound import trap_CM_LerpTag import trap_UpdateScreen import trap_R_DrawStretchPic import trap_R_SetColor import trap_R_RenderScene import trap_R_AddLightToScene import trap_R_AddPolyToScene import trap_R_AddRefEntityToScene import trap_R_ClearScene import trap_R_RegisterShaderNoMip import trap_R_RegisterSkin import trap_R_RegisterModel import trap_FS_Seek import trap_FS_GetFileList import trap_FS_FCloseFile import trap_FS_Write import trap_FS_Read import trap_FS_FOpenFile import trap_Cmd_ExecuteText import trap_Argv import trap_Argc import trap_Cvar_InfoStringBuffer import trap_Cvar_Create import trap_Cvar_Reset import trap_Cvar_SetValue import trap_Cvar_VariableStringBuffer import trap_Cvar_VariableValue import trap_Cvar_Set import trap_Cvar_Update import trap_Cvar_Register import trap_Milliseconds import trap_Error import trap_Print import UI_SPSkillMenu_Cache import UI_SPSkillMenu import UI_SPPostgameMenu_f import UI_SPPostgameMenu_Cache import UI_SPArena_Start import UI_SPLevelMenu_ReInit import UI_SPLevelMenu_f import UI_SPLevelMenu import UI_SPLevelMenu_Cache import uis import m_entersound import UI_StartDemoLoop import UI_Cvar_VariableString import UI_Argv import UI_ForceMenuOff import UI_PopMenu import UI_PushMenu import UI_SetActiveMenu import UI_IsFullscreen import UI_DrawTextBox import UI_AdjustFrom640 import UI_CursorInRect import UI_DrawChar import UI_DrawString import UI_ProportionalStringWidth import UI_DrawProportionalString_AutoWrapped import UI_DrawProportionalString import UI_ProportionalSizeScale import UI_DrawBannerString import UI_LerpColor import UI_SetColor import UI_UpdateScreen import UI_DrawRect import UI_FillRect import UI_DrawHandlePic import UI_DrawNamedPic import UI_ClampCvar import UI_ConsoleCommand import UI_Refresh import UI_MouseEvent import UI_KeyEvent import UI_Shutdown import UI_Init import UI_RegisterClientModelname import UI_PlayerInfo_SetInfo import UI_PlayerInfo_SetModel import UI_DrawPlayer import DriverInfo_Cache import GraphicsOptions_Cache import UI_GraphicsOptionsMenu import ServerInfo_Cache import UI_ServerInfoMenu import UI_BotSelectMenu_Cache import UI_BotSelectMenu import ServerOptions_Cache import StartServer_Cache import UI_StartServerMenu import ArenaServers_Cache import UI_ArenaServersMenu import SpecifyServer_Cache import UI_SpecifyServerMenu import SpecifyLeague_Cache import UI_SpecifyLeagueMenu import Preferences_Cache import UI_PreferencesMenu import PlayerSettings_Cache import UI_PlayerSettingsMenu import PlayerModel_Cache import UI_PlayerModelMenu import UI_CDKeyMenu_f import UI_CDKeyMenu_Cache import UI_CDKeyMenu import UI_ModsMenu_Cache import UI_ModsMenu import UI_CinematicsMenu_Cache import UI_CinematicsMenu_f import UI_CinematicsMenu import Demos_Cache import UI_DemosMenu import Controls_Cache import UI_ControlsMenu import UI_DrawConnectScreen import TeamMain_Cache import UI_TeamMainMenu import UI_SetupMenu import UI_SetupMenu_Cache import UI_Message import UI_ConfirmMenu_Style import UI_ConfirmMenu import ConfirmMenu_Cache import UI_InGameMenu import InGame_Cache import UI_CreditMenu import UI_UpdateCvars import UI_RegisterCvars import UI_MainMenu import MainMenu_Cache import MenuField_Key import MenuField_Draw import MenuField_Init import MField_Draw import MField_CharEvent import MField_KeyDownEvent import MField_Clear import ui_medalSounds import ui_medalPicNames import ui_medalNames import text_color_highlight import text_color_normal import text_color_disabled import listbar_color import list_color import name_color import color_dim import color_red import color_orange import color_blue import color_yellow import color_white import color_black import menu_dim_color import menu_black_color import menu_red_color import menu_highlight_color import menu_dark_color import menu_grayed_color import menu_text_color import weaponChangeSound import menu_null_sound import menu_buzz_sound import menu_out_sound import menu_move_sound import menu_in_sound import ScrollList_Key import ScrollList_Draw import Bitmap_Draw import Bitmap_Init import Menu_DefaultKey import Menu_SetCursorToItem import Menu_SetCursor import Menu_ActivateItem import Menu_ItemAtCursor import Menu_Draw import Menu_AdjustCursor import Menu_AddItem import Menu_Focus import Menu_Cache import ui_ioq3 import ui_cdkeychecked import ui_cdkey import ui_server16 import ui_server15 import ui_server14 import ui_server13 import ui_server12 import ui_server11 import ui_server10 import ui_server9 import ui_server8 import ui_server7 import ui_server6 import ui_server5 import ui_server4 import ui_server3 import ui_server2 import ui_server1 import ui_marks import ui_drawCrosshairNames import ui_drawCrosshair import ui_brassTime import ui_browserShowEmpty import ui_browserShowFull import ui_browserSortKey import ui_browserGameType import ui_browserMaster import ui_spSelection import ui_spSkill import ui_spVideos import ui_spAwards import ui_spScores5 import ui_spScores4 import ui_spScores3 import ui_spScores2 import ui_spScores1 import ui_botsFile import ui_arenasFile import ui_ctf_friendly import ui_ctf_timelimit import ui_ctf_capturelimit import ui_team_friendly import ui_team_timelimit import ui_team_fraglimit import ui_tourney_timelimit import ui_tourney_fraglimit import ui_ffa_timelimit import ui_ffa_fraglimit import BG_PlayerTouchesItem import BG_PlayerStateToEntityStateExtraPolate import BG_PlayerStateToEntityState import BG_TouchJumpPad import BG_AddPredictableEventToPlayerstate import BG_EvaluateTrajectoryDelta import BG_EvaluateTrajectory import BG_CanItemBeGrabbed import BG_FindItemForHoldable import BG_FindItemForPowerup import BG_FindItemForWeapon import BG_FindItem import bg_numItems import bg_itemlist import Pmove import PM_UpdateViewAngles import Com_Printf import Com_Error import Info_NextPair import Info_Validate import Info_SetValueForKey_Big import Info_SetValueForKey import Info_RemoveKey_Big import Info_RemoveKey import Info_ValueForKey import Com_TruncateLongString import va import Q_CountChar import Q_CleanStr import Q_PrintStrlen import Q_strcat import Q_strncpyz import Q_stristr import Q_strupr import Q_strlwr import Q_stricmpn import Q_strncmp import Q_stricmp import Q_isintegral import Q_isanumber import Q_isalpha import Q_isupper import Q_islower import Q_isprint import Com_RandomBytes import Com_SkipCharset import Com_SkipTokens import Com_sprintf import Com_HexStrToInt import Parse3DMatrix import Parse2DMatrix import Parse1DMatrix import SkipRestOfLine import SkipBracedSection import COM_MatchToken import COM_ParseWarning import COM_ParseError import COM_Compress import COM_ParseExt import COM_Parse import COM_GetCurrentParseLine import COM_BeginParseSession import COM_DefaultExtension import COM_CompareExtension import COM_StripExtension import COM_GetExtension import COM_SkipPath import Com_Clamp import PerpendicularVector import AngleVectors import MatrixMultiply import MakeNormalVectors import RotateAroundDirection import RotatePointAroundVector import ProjectPointOnPlane import PlaneFromPoints import AngleDelta import AngleNormalize180 import AngleNormalize360 import AnglesSubtract import AngleSubtract import LerpAngle import AngleMod import BoundsIntersectPoint import BoundsIntersectSphere import BoundsIntersect import BoxOnPlaneSide import SetPlaneSignbits import AxisCopy import AxisClear import AnglesToAxis import vectoangles import Q_crandom import Q_random import Q_rand import Q_acos import Q_log2 import VectorRotate import Vector4Scale import VectorNormalize2 import VectorNormalize import CrossProduct import VectorInverse import VectorNormalizeFast import DistanceSquared import Distance import VectorLengthSquared import VectorLength import VectorCompare import AddPointToBounds import ClearBounds import RadiusFromBounds import NormalizeColor import ColorBytes4 import ColorBytes3 import _VectorMA import _VectorScale import _VectorCopy import _VectorAdd import _VectorSubtract import _DotProduct import ByteToDir import DirToByte import ClampShort import ClampChar import Q_rsqrt import Q_fabs import Q_isnan import axisDefault import vec3_origin import g_color_table import colorDkGrey import colorMdGrey import colorLtGrey import colorWhite import colorCyan import colorMagenta import colorYellow import colorBlue import colorGreen import colorRed import colorBlack import bytedirs import Hunk_AllocDebug import FloatSwap import LongSwap import ShortSwap import CopyLongSwap import CopyShortSwap import qk_acos import qk_fabs import qk_abs import qk_tan import qk_atan2 import qk_cos import qk_sin import qk_sqrt import qk_floor import qk_ceil import qk_memcpy import qk_memset import qk_memmove import qk_sscanf import qk_vsnprintf import qk_strtol import qk_atoi import qk_strtod import qk_atof import qk_toupper import qk_tolower import qk_strncpy import qk_strstr import qk_strrchr import qk_strchr import qk_strcmp import qk_strcpy import qk_strcat import qk_strlen import qk_rand import qk_srand import qk_qsort lit align 1 LABELV $219 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 97 byte 1 114 byte 1 114 byte 1 111 byte 1 119 byte 1 115 byte 1 95 byte 1 118 byte 1 101 byte 1 114 byte 1 116 byte 1 95 byte 1 98 byte 1 111 byte 1 116 byte 1 0 align 1 LABELV $201 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 97 byte 1 114 byte 1 114 byte 1 111 byte 1 119 byte 1 115 byte 1 95 byte 1 118 byte 1 101 byte 1 114 byte 1 116 byte 1 95 byte 1 116 byte 1 111 byte 1 112 byte 1 0 align 1 LABELV $173 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 97 byte 1 114 byte 1 114 byte 1 111 byte 1 119 byte 1 115 byte 1 95 byte 1 118 byte 1 101 byte 1 114 byte 1 116 byte 1 95 byte 1 48 byte 1 0 align 1 LABELV $152 byte 1 82 byte 1 69 byte 1 77 byte 1 79 byte 1 86 byte 1 69 byte 1 32 byte 1 66 byte 1 79 byte 1 84 byte 1 83 byte 1 0 align 1 LABELV $136 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 100 byte 1 101 byte 1 108 byte 1 101 byte 1 116 byte 1 101 byte 1 95 byte 1 49 byte 1 0 align 1 LABELV $135 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 100 byte 1 101 byte 1 108 byte 1 101 byte 1 116 byte 1 101 byte 1 95 byte 1 48 byte 1 0 align 1 LABELV $134 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 98 byte 1 97 byte 1 99 byte 1 107 byte 1 95 byte 1 49 byte 1 0 align 1 LABELV $133 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 98 byte 1 97 byte 1 99 byte 1 107 byte 1 95 byte 1 48 byte 1 0 align 1 LABELV $132 byte 1 109 byte 1 101 byte 1 110 byte 1 117 byte 1 47 byte 1 97 byte 1 114 byte 1 116 byte 1 47 byte 1 97 byte 1 100 byte 1 100 byte 1 98 byte 1 111 byte 1 116 byte 1 102 byte 1 114 byte 1 97 byte 1 109 byte 1 101 byte 1 0 align 1 LABELV $125 byte 1 115 byte 1 107 byte 1 105 byte 1 108 byte 1 108 byte 1 0 align 1 LABELV $119 byte 1 115 byte 1 118 byte 1 95 byte 1 109 byte 1 97 byte 1 120 byte 1 99 byte 1 108 byte 1 105 byte 1 101 byte 1 110 byte 1 116 byte 1 115 byte 1 0 align 1 LABELV $86 byte 1 99 byte 1 108 byte 1 105 byte 1 101 byte 1 110 byte 1 116 byte 1 107 byte 1 105 byte 1 99 byte 1 107 byte 1 32 byte 1 37 byte 1 105 byte 1 10 byte 1 0 align 1 LABELV $79 byte 1 110 byte 1 0
dnl SPARC T1 32-bit mpn_sub_n. dnl Copyright 2010 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C INPUT PARAMETERS define(`rp', %o0) define(`ap', %o1) define(`bp', %o2) define(`n', %o3) define(`cy', %o4) define(`i', %o3) MULFUNC_PROLOGUE(mpn_sub_n mpn_sub_nc) ASM_START() PROLOGUE(mpn_sub_nc) b L(ent) srl cy, 0, cy C strip any bogus high bits EPILOGUE() PROLOGUE(mpn_sub_n) mov 0, cy L(ent): srl n, 0, n C strip any bogus high bits sll n, 2, n add ap, n, ap add bp, n, bp add rp, n, rp neg n, i L(top): lduw [ap+i], %g1 lduw [bp+i], %g2 sub %g1, %g2, %g3 sub %g3, cy, %g3 stw %g3, [rp+i] add i, 4, i brnz i, L(top) srlx %g3, 63, cy retl mov cy, %o0 C return value EPILOGUE()
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" #include "beatsaber-hook/shared/utils/byref.hpp" // Including type: System.Enum #include "System/Enum.hpp" // Completed includes // Type namespace: System.Xml.Linq namespace System::Xml::Linq { // Forward declaring type: XObjectChange struct XObjectChange; } #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" DEFINE_IL2CPP_ARG_TYPE(::System::Xml::Linq::XObjectChange, "System.Xml.Linq", "XObjectChange"); // Type namespace: System.Xml.Linq namespace System::Xml::Linq { // Size: 0x4 #pragma pack(push, 1) // Autogenerated type: System.Xml.Linq.XObjectChange // [TokenAttribute] Offset: FFFFFFFF struct XObjectChange/*, public ::System::Enum*/ { public: public: // public System.Int32 value__ // Size: 0x4 // Offset: 0x0 int value; // Field size check static_assert(sizeof(int) == 0x4); public: // Creating value type constructor for type: XObjectChange constexpr XObjectChange(int value_ = {}) noexcept : value{value_} {} // Creating interface conversion operator: operator ::System::Enum operator ::System::Enum() noexcept { return *reinterpret_cast<::System::Enum*>(this); } // Creating conversion operator: operator int constexpr operator int() const noexcept { return value; } // static field const value: static public System.Xml.Linq.XObjectChange Add static constexpr const int Add = 0; // Get static field: static public System.Xml.Linq.XObjectChange Add static ::System::Xml::Linq::XObjectChange _get_Add(); // Set static field: static public System.Xml.Linq.XObjectChange Add static void _set_Add(::System::Xml::Linq::XObjectChange value); // static field const value: static public System.Xml.Linq.XObjectChange Remove static constexpr const int Remove = 1; // Get static field: static public System.Xml.Linq.XObjectChange Remove static ::System::Xml::Linq::XObjectChange _get_Remove(); // Set static field: static public System.Xml.Linq.XObjectChange Remove static void _set_Remove(::System::Xml::Linq::XObjectChange value); // static field const value: static public System.Xml.Linq.XObjectChange Name static constexpr const int Name = 2; // Get static field: static public System.Xml.Linq.XObjectChange Name static ::System::Xml::Linq::XObjectChange _get_Name(); // Set static field: static public System.Xml.Linq.XObjectChange Name static void _set_Name(::System::Xml::Linq::XObjectChange value); // static field const value: static public System.Xml.Linq.XObjectChange Value static constexpr const int Value = 3; // Get static field: static public System.Xml.Linq.XObjectChange Value static ::System::Xml::Linq::XObjectChange _get_Value(); // Set static field: static public System.Xml.Linq.XObjectChange Value static void _set_Value(::System::Xml::Linq::XObjectChange value); // Get instance field reference: public System.Int32 value__ [[deprecated("Use field access instead!")]] int& dyn_value__(); }; // System.Xml.Linq.XObjectChange #pragma pack(pop) static check_size<sizeof(XObjectChange), 0 + sizeof(int)> __System_Xml_Linq_XObjectChangeSizeCheck; static_assert(sizeof(XObjectChange) == 0x4); } #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#pragma once #include "WinDesktopApplication.hpp" class Application : public WinDesktopApplication { public: Application() {}; protected: int main_impl() final; };
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/gfx/rect_f.h" #include <algorithm> #include "base/logging.h" #include "base/stringprintf.h" #include "ui/gfx/insets_f.h" #include "ui/gfx/rect_base_impl.h" namespace gfx { template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; typedef class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> RectBaseT; RectF::RectF() : RectBaseT(gfx::SizeF()) { } RectF::RectF(float width, float height) : RectBaseT(gfx::SizeF(width, height)) { } RectF::RectF(float x, float y, float width, float height) : RectBaseT(gfx::PointF(x, y), gfx::SizeF(width, height)) { } RectF::RectF(const gfx::SizeF& size) : RectBaseT(size) { } RectF::RectF(const gfx::PointF& origin, const gfx::SizeF& size) : RectBaseT(origin, size) { } RectF::~RectF() {} std::string RectF::ToString() const { return base::StringPrintf("%s %s", origin().ToString().c_str(), size().ToString().c_str()); } RectF IntersectRects(const RectF& a, const RectF& b) { RectF result = a; result.Intersect(b); return result; } RectF UnionRects(const RectF& a, const RectF& b) { RectF result = a; result.Union(b); return result; } RectF SubtractRects(const RectF& a, const RectF& b) { RectF result = a; result.Subtract(b); return result; } RectF ScaleRect(const RectF& r, float x_scale, float y_scale) { RectF result = r; result.Scale(x_scale, y_scale); return result; } RectF BoundingRect(const PointF& p1, const PointF& p2) { float rx = std::min(p1.x(), p2.x()); float ry = std::min(p1.y(), p2.y()); float rr = std::max(p1.x(), p2.x()); float rb = std::max(p1.y(), p2.y()); return RectF(rx, ry, rr - rx, rb - ry); } } // namespace gfx