2012-04-17 16:20:28 +00:00
|
|
|
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
2011-11-07 15:04:42 +00:00
|
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef BIN_PLATFORM_H_
|
|
|
|
#define BIN_PLATFORM_H_
|
|
|
|
|
|
|
|
#include "bin/builtin.h"
|
|
|
|
|
|
|
|
class Platform {
|
|
|
|
public:
|
2011-11-23 14:49:18 +00:00
|
|
|
// Perform platform specific initialization.
|
|
|
|
static bool Initialize();
|
|
|
|
|
2011-11-09 11:22:33 +00:00
|
|
|
// Returns the number of processors on the machine.
|
2011-11-07 15:04:42 +00:00
|
|
|
static int NumberOfProcessors();
|
2011-11-09 11:22:33 +00:00
|
|
|
|
|
|
|
// Returns a string representing the operating system ("linux",
|
|
|
|
// "macos" or "windows"). The returned string should not be
|
|
|
|
// deallocated by the caller.
|
2011-11-07 15:04:42 +00:00
|
|
|
static const char* OperatingSystem();
|
|
|
|
|
2012-04-11 12:27:55 +00:00
|
|
|
// Extracts the local hostname.
|
2012-04-17 16:20:28 +00:00
|
|
|
static bool LocalHostname(char* buffer, intptr_t buffer_length);
|
|
|
|
|
2012-11-13 15:03:23 +00:00
|
|
|
// Extracts the environment variables for the current process. The
|
|
|
|
// array of strings returned must be deallocated using
|
|
|
|
// FreeEnvironment. The number of elements in the array is returned
|
2012-04-17 16:20:28 +00:00
|
|
|
// in the count argument.
|
|
|
|
static char** Environment(intptr_t* count);
|
2012-11-13 15:03:23 +00:00
|
|
|
static void FreeEnvironment(char** env, intptr_t count);
|
2012-04-11 12:27:55 +00:00
|
|
|
|
2011-11-07 15:04:42 +00:00
|
|
|
private:
|
|
|
|
DISALLOW_ALLOCATION();
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Platform);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BIN_PLATFORM_H_
|