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 BIN_PLATFORM_H_ | 5 #ifndef BIN_PLATFORM_H_ |
6 #define BIN_PLATFORM_H_ | 6 #define BIN_PLATFORM_H_ |
7 | 7 |
8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
9 | 9 |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 static void FreeEnvironment(char** env, intptr_t count); | 35 static void FreeEnvironment(char** env, intptr_t count); |
36 | 36 |
37 // Stores and gets the executable name. | 37 // Stores and gets the executable name. |
38 static void SetExecutableName(const char* executable_name) { | 38 static void SetExecutableName(const char* executable_name) { |
39 executable_name_ = executable_name; | 39 executable_name_ = executable_name; |
40 } | 40 } |
41 static const char* GetExecutableName() { | 41 static const char* GetExecutableName() { |
42 return executable_name_; | 42 return executable_name_; |
43 } | 43 } |
44 | 44 |
| 45 // Stores and gets the package root. |
| 46 static void SetPackageRoot(const char* package_root) { |
| 47 package_root_ = package_root; |
| 48 } |
| 49 static const char* GetPackageRoot() { |
| 50 return package_root_; |
| 51 } |
| 52 |
| 53 // Stores and gets the flags passed to the executable. |
| 54 static void SetExecutableArguments(int script_index, char** argv) { |
| 55 script_index_ = script_index; |
| 56 argv_ = argv; |
| 57 } |
| 58 static int GetScriptIndex() { |
| 59 return script_index_; |
| 60 } |
| 61 static char** GetArgv() { |
| 62 return argv_; |
| 63 } |
| 64 |
45 private: | 65 private: |
46 static const char* executable_name_; | 66 static const char* executable_name_; |
| 67 static const char* package_root_; |
| 68 static int script_index_; |
| 69 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] |
47 | 70 |
48 DISALLOW_ALLOCATION(); | 71 DISALLOW_ALLOCATION(); |
49 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); | 72 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); |
50 }; | 73 }; |
51 | 74 |
52 } // namespace bin | 75 } // namespace bin |
53 } // namespace dart | 76 } // namespace dart |
54 | 77 |
55 #endif // BIN_PLATFORM_H_ | 78 #endif // BIN_PLATFORM_H_ |
OLD | NEW |