| 1 | // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 | |
| 5 | #ifndef RUNTIME_INCLUDE_BIN_DART_IO_API_H_ |
| 6 | #define RUNTIME_INCLUDE_BIN_DART_IO_API_H_ |
| 7 | |
| 8 | #include "dart_tools_api.h" |
| 9 | |
| 10 | namespace dart { |
| 11 | namespace bin { |
| 12 | |
| 13 | // Bootstraps 'dart:io'. |
| 14 | void BootstrapDartIo(); |
| 15 | |
| 16 | // Cleans up 'dart:io'. |
| 17 | void CleanupDartIo(); |
| 18 | |
| 19 | // Lets dart:io know where the system temporary directory is located. |
| 20 | // Currently only wired up on Android. |
| 21 | void SetSystemTempDirectory(const char* system_temp); |
| 22 | |
| 23 | // Tells the system whether to capture Stdout events. |
| 24 | void SetCaptureStdout(bool value); |
| 25 | |
| 26 | // Tells the system whether to capture Stderr events. |
| 27 | void SetCaptureStderr(bool value); |
| 28 | |
| 29 | // Should Stdout events be captured? |
| 30 | bool ShouldCaptureStdout(); |
| 31 | |
| 32 | // Should Stderr events be captured? |
| 33 | bool ShouldCaptureStderr(); |
| 34 | |
| 35 | // Set the executable name used by Platform.executable. |
| 36 | void SetExecutableName(const char* executable_name); |
| 37 | |
| 38 | // Set the arguments used by Platform.executableArguments. |
| 39 | void SetExecutableArguments(int script_index, char** argv); |
| 40 | |
| 41 | // Set dart:io implementation specific fields of Dart_EmbedderInformation. |
| 42 | void GetIOEmbedderInformation(Dart_EmbedderInformation* info); |
| 43 | |
| 44 | // Generates 'length' random bytes into 'buffer'. Returns true on success |
| 45 | // and false on failure. This is appropriate to assign to |
| 46 | // Dart_InitializeParams.entropy_source. |
| 47 | bool GetEntropy(uint8_t* buffer, intptr_t length); |
| 48 | |
| 49 | // Performs a lookup of the I/O Dart_NativeFunction with a specified 'name' and |
| 50 | // 'argument_count'. Returns NULL if no I/O native function with a matching |
| 51 | // name and parameter count is found. |
| 52 | Dart_NativeFunction LookupIONative(Dart_Handle name, |
| 53 | int argument_count, |
| 54 | bool* auto_setup_scope); |
| 55 | |
| 56 | // Returns the symbol for I/O native function 'nf'. Returns NULL if 'nf' is not |
| 57 | // a valid I/O native function. |
| 58 | const uint8_t* LookupIONativeSymbol(Dart_NativeFunction nf); |
| 59 | |
| 60 | } // namespace bin |
| 61 | } // namespace dart |
| 62 | |
| 63 | #endif // RUNTIME_INCLUDE_BIN_DART_IO_API_H_ |
| 64 | |