| 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 #ifndef VM_FLAGS_H_ | 5 #ifndef VM_FLAGS_H_ |
| 6 #define VM_FLAGS_H_ | 6 #define VM_FLAGS_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 DEFINE_FLAG(type, name, default_value, comment) | 29 DEFINE_FLAG(type, name, default_value, comment) |
| 30 #else | 30 #else |
| 31 #define DECLARE_DEBUG_FLAG(type, name) | 31 #define DECLARE_DEBUG_FLAG(type, name) |
| 32 #define DEFINE_DEBUG_FLAG(type, name, default_value, comment) | 32 #define DEFINE_DEBUG_FLAG(type, name, default_value, comment) |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 namespace dart { | 35 namespace dart { |
| 36 | 36 |
| 37 typedef void (*FlagHandler)(bool value); | 37 typedef void (*FlagHandler)(bool value); |
| 38 | 38 |
| 39 // Forward declaration. | 39 // Forward declarations. |
| 40 class Flag; | 40 class Flag; |
| 41 class JSONArray; |
| 42 class JSONStream; |
| 41 | 43 |
| 42 class Flags { | 44 class Flags { |
| 43 public: | 45 public: |
| 44 static bool Register_bool(bool* addr, | 46 static bool Register_bool(bool* addr, |
| 45 const char* name, | 47 const char* name, |
| 46 bool default_value, | 48 bool default_value, |
| 47 const char* comment); | 49 const char* comment); |
| 48 | 50 |
| 49 static int Register_int(int* addr, | 51 static int Register_int(int* addr, |
| 50 const char* name, | 52 const char* name, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 const char* comment); | 63 const char* comment); |
| 62 | 64 |
| 63 static bool ProcessCommandLineFlags(int argc, const char** argv); | 65 static bool ProcessCommandLineFlags(int argc, const char** argv); |
| 64 | 66 |
| 65 static Flag* Lookup(const char* name); | 67 static Flag* Lookup(const char* name); |
| 66 | 68 |
| 67 static bool IsSet(const char* name); | 69 static bool IsSet(const char* name); |
| 68 | 70 |
| 69 static bool Initialized() { return initialized_; } | 71 static bool Initialized() { return initialized_; } |
| 70 | 72 |
| 73 static void PrintJSON(JSONStream* js); |
| 74 |
| 75 static bool SetFlag(const char* name, |
| 76 const char* value, |
| 77 const char** error); |
| 78 |
| 71 private: | 79 private: |
| 72 static Flag* flags_; | 80 static Flag** flags_; |
| 81 static intptr_t capacity_; |
| 82 static intptr_t num_flags_; |
| 73 | 83 |
| 74 static bool initialized_; | 84 static bool initialized_; |
| 75 | 85 |
| 86 static void AddFlag(Flag* flag); |
| 87 |
| 88 static bool SetFlagFromString(Flag* flag, const char* argument); |
| 89 |
| 76 static void Parse(const char* option); | 90 static void Parse(const char* option); |
| 77 | 91 |
| 78 static int CompareFlagNames(const void* left, const void* right); | 92 static int CompareFlagNames(const void* left, const void* right); |
| 79 | 93 |
| 80 static void PrintFlags(); | 94 static void PrintFlags(); |
| 81 | 95 |
| 96 static void PrintFlagToJSONArray(JSONArray* jsarr, const Flag* flag); |
| 97 |
| 82 // Testing needs direct access to private methods. | 98 // Testing needs direct access to private methods. |
| 83 friend void Dart_TestParseFlags(); | 99 friend void Dart_TestParseFlags(); |
| 84 | 100 |
| 85 DISALLOW_ALLOCATION(); | 101 DISALLOW_ALLOCATION(); |
| 86 DISALLOW_IMPLICIT_CONSTRUCTORS(Flags); | 102 DISALLOW_IMPLICIT_CONSTRUCTORS(Flags); |
| 87 }; | 103 }; |
| 88 | 104 |
| 89 } // namespace dart | 105 } // namespace dart |
| 90 | 106 |
| 91 #endif // VM_FLAGS_H_ | 107 #endif // VM_FLAGS_H_ |
| OLD | NEW |