| 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 class Platform { | 10 class Platform { |
| 11 public: | 11 public: |
| 12 // Perform platform specific initialization. | 12 // Perform platform specific initialization. |
| 13 static bool Initialize(); | 13 static bool Initialize(); |
| 14 | 14 |
| 15 // Returns the number of processors on the machine. | 15 // Returns the number of processors on the machine. |
| 16 static int NumberOfProcessors(); | 16 static int NumberOfProcessors(); |
| 17 | 17 |
| 18 // Returns a string representing the operating system ("linux", | 18 // Returns a string representing the operating system ("linux", |
| 19 // "macos" or "windows"). The returned string should not be | 19 // "macos" or "windows"). The returned string should not be |
| 20 // deallocated by the caller. | 20 // deallocated by the caller. |
| 21 static const char* OperatingSystem(); | 21 static const char* OperatingSystem(); |
| 22 | 22 |
| 23 // Returns a string representation of an error code. The returned | 23 // Returns a string representation of an error code. The returned |
| 24 // string must be deallocated by the caller. | 24 // string must be deallocated by the caller. |
| 25 static char* StrError(int error_code); | 25 static char* StrError(int error_code); |
| 26 | 26 |
| 27 // Extracts the local hostname. | 27 // Extracts the local hostname. |
| 28 static bool LocalHostname(char* buffer, intptr_t buffer_length); | 28 static bool LocalHostname(char* buffer, intptr_t buffer_length); |
| 29 | 29 |
| 30 // Extracts the environment variables for the current process. | 30 // Extracts the environment variables for the current process. The |
| 31 // The array of strings returned must be deallocated using | 31 // array of strings returned must be deallocated using |
| 32 // delete[]. The number of elements in the array is returned | 32 // FreeEnvironment. The number of elements in the array is returned |
| 33 // in the count argument. | 33 // in the count argument. |
| 34 static char** Environment(intptr_t* count); | 34 static char** Environment(intptr_t* count); |
| 35 static void FreeEnvironment(char** env, intptr_t count); |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 DISALLOW_ALLOCATION(); | 38 DISALLOW_ALLOCATION(); |
| 38 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); | 39 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 #endif // BIN_PLATFORM_H_ | 42 #endif // BIN_PLATFORM_H_ |
| OLD | NEW |