| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/flags.h" | 5 #include "vm/flags.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 while (cur != NULL) { | 91 while (cur != NULL) { |
| 92 if (strcmp(cur->name_, name) == 0) { | 92 if (strcmp(cur->name_, name) == 0) { |
| 93 return cur; | 93 return cur; |
| 94 } | 94 } |
| 95 cur = cur->next_; | 95 cur = cur->next_; |
| 96 } | 96 } |
| 97 return NULL; | 97 return NULL; |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 bool Flags::IsSet(const char* name) { |
| 102 Flag* flag = Lookup(name); |
| 103 return (flag != NULL) && |
| 104 (flag->type_ == Flag::kBoolean) && |
| 105 (flag->bool_ptr_ != NULL) && |
| 106 (*flag->bool_ptr_ == true); |
| 107 } |
| 108 |
| 109 |
| 101 bool Flags::Register_bool(bool* addr, | 110 bool Flags::Register_bool(bool* addr, |
| 102 const char* name, | 111 const char* name, |
| 103 bool default_value, | 112 bool default_value, |
| 104 const char* comment) { | 113 const char* comment) { |
| 105 Flag* flag = Lookup(name); | 114 Flag* flag = Lookup(name); |
| 106 if (flag != NULL) { | 115 if (flag != NULL) { |
| 107 ASSERT(flag->IsUnrecognized()); | 116 ASSERT(flag->IsUnrecognized()); |
| 108 return default_value; | 117 return default_value; |
| 109 } | 118 } |
| 110 flag = new Flag(name, comment, addr, Flag::kBoolean); | 119 flag = new Flag(name, comment, addr, Flag::kBoolean); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 } | 341 } |
| 333 | 342 |
| 334 qsort(flag_array, num_flags, sizeof flag_array[0], CompareFlagNames); | 343 qsort(flag_array, num_flags, sizeof flag_array[0], CompareFlagNames); |
| 335 | 344 |
| 336 for (int i = 0; i < num_flags; ++i) { | 345 for (int i = 0; i < num_flags; ++i) { |
| 337 flag_array[i]->Print(); | 346 flag_array[i]->Print(); |
| 338 } | 347 } |
| 339 delete[] flag_array; | 348 delete[] flag_array; |
| 340 } | 349 } |
| 341 } // namespace dart | 350 } // namespace dart |
| OLD | NEW |