| 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 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 | 10 |
| 11 #include "platform/assert.h" | 11 #include "platform/assert.h" |
| 12 | 12 |
| 13 #include "bin/builtin.h" | 13 #include "bin/builtin.h" |
| 14 #include "bin/dartutils.h" | 14 #include "bin/dartutils.h" |
| 15 #include "bin/io_natives.h" | 15 #include "bin/io_natives.h" |
| 16 #include "bin/platform.h" | 16 #include "bin/platform.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 namespace bin { | 19 namespace bin { |
| 20 | 20 |
| 21 // Lists the native functions implementing basic functionality in | 21 // Lists the native functions implementing basic functionality in |
| 22 // standalone dart, such as printing, file I/O, and platform information. | 22 // standalone dart, such as printing, file I/O, and platform information. |
| 23 // Advanced I/O classes like sockets and process management are implemented | 23 // Advanced I/O classes like sockets and process management are implemented |
| 24 // using functions listed in io_natives.cc. | 24 // using functions listed in io_natives.cc. |
| 25 #define BUILTIN_NATIVE_LIST(V) \ | 25 #define BUILTIN_NATIVE_LIST(V) \ |
| 26 V(Crypto_GetRandomBytes, 1) \ |
| 26 V(Directory_Exists, 1) \ | 27 V(Directory_Exists, 1) \ |
| 27 V(Directory_Create, 1) \ | 28 V(Directory_Create, 1) \ |
| 28 V(Directory_Current, 0) \ | 29 V(Directory_Current, 0) \ |
| 29 V(Directory_SetCurrent, 1) \ | 30 V(Directory_SetCurrent, 1) \ |
| 30 V(Directory_SystemTemp, 0) \ | 31 V(Directory_SystemTemp, 0) \ |
| 31 V(Directory_CreateTemp, 1) \ | 32 V(Directory_CreateTemp, 1) \ |
| 32 V(Directory_Delete, 2) \ | 33 V(Directory_Delete, 2) \ |
| 33 V(Directory_Rename, 2) \ | 34 V(Directory_Rename, 2) \ |
| 34 V(Directory_List, 3) \ | 35 V(Directory_List, 3) \ |
| 35 V(File_Open, 2) \ | 36 V(File_Open, 2) \ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 V(File_Delete, 1) \ | 55 V(File_Delete, 1) \ |
| 55 V(File_DeleteLink, 1) \ | 56 V(File_DeleteLink, 1) \ |
| 56 V(File_Rename, 2) \ | 57 V(File_Rename, 2) \ |
| 57 V(File_Copy, 2) \ | 58 V(File_Copy, 2) \ |
| 58 V(File_RenameLink, 2) \ | 59 V(File_RenameLink, 2) \ |
| 59 V(File_ResolveSymbolicLinks, 1) \ | 60 V(File_ResolveSymbolicLinks, 1) \ |
| 60 V(File_OpenStdio, 1) \ | 61 V(File_OpenStdio, 1) \ |
| 61 V(File_GetStdioHandleType, 1) \ | 62 V(File_GetStdioHandleType, 1) \ |
| 62 V(File_GetType, 2) \ | 63 V(File_GetType, 2) \ |
| 63 V(File_AreIdentical, 2) \ | 64 V(File_AreIdentical, 2) \ |
| 64 V(FileSystemWatcher_CloseWatcher, 1) \ | |
| 65 V(FileSystemWatcher_GetSocketId, 2) \ | |
| 66 V(FileSystemWatcher_InitWatcher, 0) \ | |
| 67 V(FileSystemWatcher_IsSupported, 0) \ | |
| 68 V(FileSystemWatcher_ReadEvents, 2) \ | |
| 69 V(FileSystemWatcher_UnwatchPath, 2) \ | |
| 70 V(FileSystemWatcher_WatchPath, 4) \ | |
| 71 V(Logger_PrintString, 1) | 65 V(Logger_PrintString, 1) |
| 72 | 66 |
| 73 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); | 67 BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); |
| 74 | 68 |
| 75 static struct NativeEntries { | 69 static struct NativeEntries { |
| 76 const char* name_; | 70 const char* name_; |
| 77 Dart_NativeFunction function_; | 71 Dart_NativeFunction function_; |
| 78 int argument_count_; | 72 int argument_count_; |
| 79 } BuiltinEntries[] = { | 73 } BuiltinEntries[] = { |
| 80 BUILTIN_NATIVE_LIST(REGISTER_FUNCTION) | 74 BUILTIN_NATIVE_LIST(REGISTER_FUNCTION) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // interrupt. | 113 // interrupt. |
| 120 fprintf(stdout, "%s\n", Dart_GetError(result)); | 114 fprintf(stdout, "%s\n", Dart_GetError(result)); |
| 121 } else { | 115 } else { |
| 122 fprintf(stdout, "%.*s\n", static_cast<int>(length), chars); | 116 fprintf(stdout, "%.*s\n", static_cast<int>(length), chars); |
| 123 } | 117 } |
| 124 fflush(stdout); | 118 fflush(stdout); |
| 125 } | 119 } |
| 126 | 120 |
| 127 } // namespace bin | 121 } // namespace bin |
| 128 } // namespace dart | 122 } // namespace dart |
| OLD | NEW |