10OptionProcessor* OptionProcessor::first_ =
nullptr;
13 return name[0] ==
'-' &&
name[1] ==
'-' &&
name[2] !=
'\0';
17 return name[0] ==
'-' &&
name[1] !=
'\0';
24 if (option[
i] !=
name[
i]) {
25 if ((
name[
i] ==
'_') && (option[
i] ==
'-')) {
37 if (
p->Process(option, vm_options)) {
44static bool IsPrefix(
const char*
prefix,
size_t prefix_len,
const char* str) {
47 const size_t str_len = strlen(str);
48 if (str_len < prefix_len) {
51 return strncmp(
prefix, str, prefix_len) == 0;
60 const char* kShortPrefix =
"-D";
61 const char* kLongPrefix =
"--define=";
62 const int kShortPrefixLen = strlen(kShortPrefix);
63 const int kLongPrefixLen = strlen(kLongPrefix);
64 const bool is_short_form =
IsPrefix(kShortPrefix, kShortPrefixLen, arg);
65 const bool is_long_form =
IsPrefix(kLongPrefix, kLongPrefixLen, arg);
67 arg = arg + kShortPrefixLen;
68 }
else if (is_long_form) {
69 arg = arg + kLongPrefixLen;
81 char*
value =
nullptr;
82 const char* equals_pos = strchr(arg,
'=');
83 if (equals_pos ==
nullptr) {
92 int name_len = equals_pos - arg;
102 name =
reinterpret_cast<char*
>(
malloc(name_len + 1));
103 strncpy(
name, arg, name_len);
104 name[name_len] =
'\0';
111 if (entry->
value !=
nullptr) {
static bool SameStringValue(void *key1, void *key2)
static uint32_t StringHash(const char *key)
static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static char * StrDup(const char *s)
static bool TryProcess(const char *option, CommandLineOptions *options)
static bool IsValidShortFlag(const char *name)
static const char * ProcessOption(const char *option, const char *name)
static bool ProcessEnvironmentOption(const char *arg, CommandLineOptions *vm_options, dart::SimpleHashMap **environment)
static bool IsValidFlag(const char *name)
static void * GetHashmapKeyFromString(char *key)
static bool IsPrefix(const char *prefix, size_t prefix_len, const char *str)
static dart::SimpleHashMap * environment
void * malloc(size_t size)