Changeset View
Changeset View
Standalone View
Standalone View
src/core_read.cpp
Show All 25 Lines | CScript ParseScript(const std::string &s) { | ||||
static std::map<std::string, opcodetype> mapOpNames; | static std::map<std::string, opcodetype> mapOpNames; | ||||
if (mapOpNames.empty()) { | if (mapOpNames.empty()) { | ||||
for (int op = 0; op < FIRST_UNDEFINED_OP_VALUE; op++) { | for (int op = 0; op < FIRST_UNDEFINED_OP_VALUE; op++) { | ||||
if (op < OP_PUSHDATA1) { | if (op < OP_PUSHDATA1) { | ||||
continue; | continue; | ||||
} | } | ||||
const char *name = GetOpName((opcodetype)op); | const char *name = GetOpName(static_cast<opcodetype>(op)); | ||||
if (strcmp(name, "OP_UNKNOWN") == 0) { | if (strcmp(name, "OP_UNKNOWN") == 0) { | ||||
continue; | continue; | ||||
} | } | ||||
std::string strName(name); | std::string strName(name); | ||||
mapOpNames[strName] = (opcodetype)op; | mapOpNames[strName] = static_cast<opcodetype>(op); | ||||
// Convenience: OP_ADD and just ADD are both recognized: | // Convenience: OP_ADD and just ADD are both recognized: | ||||
boost::algorithm::replace_first(strName, "OP_", ""); | boost::algorithm::replace_first(strName, "OP_", ""); | ||||
mapOpNames[strName] = (opcodetype)op; | mapOpNames[strName] = static_cast<opcodetype>(op); | ||||
} | } | ||||
} | } | ||||
std::vector<std::string> words; | std::vector<std::string> words; | ||||
boost::algorithm::split(words, s, boost::algorithm::is_any_of(" \t\n"), | boost::algorithm::split(words, s, boost::algorithm::is_any_of(" \t\n"), | ||||
boost::algorithm::token_compress_on); | boost::algorithm::token_compress_on); | ||||
size_t push_size = 0, next_push_size = 0; | size_t push_size = 0, next_push_size = 0; | ||||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |