| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "bin/io_natives.h" | 5 #include "bin/io_natives.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "bin/builtin.h" | 10 #include "bin/builtin.h" |
| 11 #include "bin/dartutils.h" | 11 #include "bin/dartutils.h" |
| 12 #include "include/dart_api.h" | 12 #include "include/dart_api.h" |
| 13 #include "platform/assert.h" | 13 #include "platform/assert.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 namespace bin { | 16 namespace bin { |
| 17 | 17 |
| 18 // Lists the native functions implementing advanced dart:io classes. | 18 // Lists the native functions implementing advanced dart:io classes. |
| 19 // Some classes, like File and Directory, list their implementations in | 19 // Some classes, like File and Directory, list their implementations in |
| 20 // builtin_natives.cc instead. | 20 // builtin_natives.cc instead. |
| 21 #define IO_NATIVE_LIST(V) \ | 21 #define IO_NATIVE_LIST(V) \ |
| 22 V(Crypto_GetRandomBytes, 1) \ | 22 V(Crypto_GetRandomBytes, 1) \ |
| 23 V(Directory_Exists, 1) \ | 23 V(Directory_Create, 2) \ |
| 24 V(Directory_Create, 1) \ | 24 V(Directory_CreateTemp, 2) \ |
| 25 V(Directory_Current, 0) \ | 25 V(Directory_Current, 1) \ |
| 26 V(Directory_SetCurrent, 1) \ | 26 V(Directory_Delete, 3) \ |
| 27 V(Directory_SystemTemp, 0) \ | 27 V(Directory_Exists, 2) \ |
| 28 V(Directory_CreateTemp, 1) \ | 28 V(Directory_FillWithDirectoryListing, 5) \ |
| 29 V(Directory_Delete, 2) \ | |
| 30 V(Directory_Rename, 2) \ | |
| 31 V(Directory_FillWithDirectoryListing, 4) \ | |
| 32 V(Directory_GetAsyncDirectoryListerPointer, 1) \ | 29 V(Directory_GetAsyncDirectoryListerPointer, 1) \ |
| 30 V(Directory_Rename, 3) \ |
| 33 V(Directory_SetAsyncDirectoryListerPointer, 2) \ | 31 V(Directory_SetAsyncDirectoryListerPointer, 2) \ |
| 32 V(Directory_SetCurrent, 2) \ |
| 33 V(Directory_SystemTemp, 1) \ |
| 34 V(EventHandler_SendData, 3) \ | 34 V(EventHandler_SendData, 3) \ |
| 35 V(EventHandler_TimerMillisecondClock, 0) \ | 35 V(EventHandler_TimerMillisecondClock, 0) \ |
| 36 V(File_AreIdentical, 3) \ |
| 37 V(File_Close, 1) \ |
| 38 V(File_Copy, 3) \ |
| 39 V(File_Create, 2) \ |
| 40 V(File_CreateLink, 3) \ |
| 41 V(File_Delete, 2) \ |
| 42 V(File_DeleteLink, 2) \ |
| 43 V(File_Exists, 2) \ |
| 44 V(File_Flush, 1) \ |
| 36 V(File_GetPointer, 1) \ | 45 V(File_GetPointer, 1) \ |
| 46 V(File_GetStdioHandleType, 1) \ |
| 47 V(File_GetType, 3) \ |
| 48 V(File_LastAccessed, 2) \ |
| 49 V(File_LastModified, 2) \ |
| 50 V(File_Length, 1) \ |
| 51 V(File_LengthFromPath, 2) \ |
| 52 V(File_LinkTarget, 2) \ |
| 53 V(File_Lock, 4) \ |
| 54 V(File_Open, 3) \ |
| 55 V(File_OpenStdio, 1) \ |
| 56 V(File_Position, 1) \ |
| 57 V(File_Read, 2) \ |
| 58 V(File_ReadByte, 1) \ |
| 59 V(File_ReadInto, 4) \ |
| 60 V(File_Rename, 3) \ |
| 61 V(File_RenameLink, 3) \ |
| 62 V(File_ResolveSymbolicLinks, 2) \ |
| 63 V(File_SetLastAccessed, 3) \ |
| 64 V(File_SetLastModified, 3) \ |
| 37 V(File_SetPointer, 2) \ | 65 V(File_SetPointer, 2) \ |
| 38 V(File_Open, 2) \ | 66 V(File_SetPosition, 2) \ |
| 39 V(File_Exists, 1) \ | 67 V(File_Stat, 2) \ |
| 40 V(File_Close, 1) \ | 68 V(File_Truncate, 2) \ |
| 41 V(File_ReadByte, 1) \ | |
| 42 V(File_WriteByte, 2) \ | 69 V(File_WriteByte, 2) \ |
| 43 V(File_Read, 2) \ | |
| 44 V(File_ReadInto, 4) \ | |
| 45 V(File_WriteFrom, 4) \ | 70 V(File_WriteFrom, 4) \ |
| 46 V(File_Position, 1) \ | |
| 47 V(File_SetPosition, 2) \ | |
| 48 V(File_Truncate, 2) \ | |
| 49 V(File_Length, 1) \ | |
| 50 V(File_LengthFromPath, 1) \ | |
| 51 V(File_Stat, 1) \ | |
| 52 V(File_LastModified, 1) \ | |
| 53 V(File_SetLastModified, 2) \ | |
| 54 V(File_LastAccessed, 1) \ | |
| 55 V(File_SetLastAccessed, 2) \ | |
| 56 V(File_Flush, 1) \ | |
| 57 V(File_Lock, 4) \ | |
| 58 V(File_Create, 1) \ | |
| 59 V(File_CreateLink, 2) \ | |
| 60 V(File_LinkTarget, 1) \ | |
| 61 V(File_Delete, 1) \ | |
| 62 V(File_DeleteLink, 1) \ | |
| 63 V(File_Rename, 2) \ | |
| 64 V(File_Copy, 2) \ | |
| 65 V(File_RenameLink, 2) \ | |
| 66 V(File_ResolveSymbolicLinks, 1) \ | |
| 67 V(File_OpenStdio, 1) \ | |
| 68 V(File_GetStdioHandleType, 1) \ | |
| 69 V(File_GetType, 2) \ | |
| 70 V(File_AreIdentical, 2) \ | |
| 71 V(FileSystemWatcher_CloseWatcher, 1) \ | 71 V(FileSystemWatcher_CloseWatcher, 1) \ |
| 72 V(FileSystemWatcher_GetSocketId, 2) \ | 72 V(FileSystemWatcher_GetSocketId, 2) \ |
| 73 V(FileSystemWatcher_InitWatcher, 0) \ | 73 V(FileSystemWatcher_InitWatcher, 0) \ |
| 74 V(FileSystemWatcher_IsSupported, 0) \ | 74 V(FileSystemWatcher_IsSupported, 0) \ |
| 75 V(FileSystemWatcher_ReadEvents, 2) \ | 75 V(FileSystemWatcher_ReadEvents, 2) \ |
| 76 V(FileSystemWatcher_UnwatchPath, 2) \ | 76 V(FileSystemWatcher_UnwatchPath, 2) \ |
| 77 V(FileSystemWatcher_WatchPath, 4) \ | 77 V(FileSystemWatcher_WatchPath, 5) \ |
| 78 V(Filter_CreateZLibDeflate, 8) \ | 78 V(Filter_CreateZLibDeflate, 8) \ |
| 79 V(Filter_CreateZLibInflate, 4) \ | 79 V(Filter_CreateZLibInflate, 4) \ |
| 80 V(Filter_Process, 4) \ | 80 V(Filter_Process, 4) \ |
| 81 V(Filter_Processed, 3) \ | 81 V(Filter_Processed, 3) \ |
| 82 V(InternetAddress_Parse, 1) \ | 82 V(InternetAddress_Parse, 1) \ |
| 83 V(IOService_NewServicePort, 0) \ | 83 V(IOService_NewServicePort, 0) \ |
| 84 V(Namespace_Create, 2) \ |
| 85 V(Namespace_GetDefault, 0) \ |
| 86 V(Namespace_GetPointer, 1) \ |
| 84 V(NetworkInterface_ListSupported, 0) \ | 87 V(NetworkInterface_ListSupported, 0) \ |
| 85 V(Platform_NumberOfProcessors, 0) \ | 88 V(Platform_NumberOfProcessors, 0) \ |
| 86 V(Platform_OperatingSystem, 0) \ | 89 V(Platform_OperatingSystem, 0) \ |
| 87 V(Platform_PathSeparator, 0) \ | 90 V(Platform_PathSeparator, 0) \ |
| 88 V(Platform_LocalHostname, 0) \ | 91 V(Platform_LocalHostname, 0) \ |
| 89 V(Platform_ExecutableName, 0) \ | 92 V(Platform_ExecutableName, 0) \ |
| 90 V(Platform_ResolvedExecutableName, 0) \ | 93 V(Platform_ResolvedExecutableName, 0) \ |
| 91 V(Platform_Environment, 0) \ | 94 V(Platform_Environment, 0) \ |
| 92 V(Platform_ExecutableArguments, 0) \ | 95 V(Platform_ExecutableArguments, 0) \ |
| 93 V(Platform_GetVersion, 0) \ | 96 V(Platform_GetVersion, 0) \ |
| 94 V(Platform_LocaleName, 0) \ | 97 V(Platform_LocaleName, 0) \ |
| 95 V(Process_Start, 11) \ | 98 V(Process_Start, 12) \ |
| 96 V(Process_Wait, 5) \ | 99 V(Process_Wait, 5) \ |
| 97 V(Process_KillPid, 2) \ | 100 V(Process_KillPid, 2) \ |
| 98 V(Process_SetExitCode, 1) \ | 101 V(Process_SetExitCode, 1) \ |
| 99 V(Process_GetExitCode, 0) \ | 102 V(Process_GetExitCode, 0) \ |
| 100 V(Process_Exit, 1) \ | 103 V(Process_Exit, 1) \ |
| 101 V(Process_Sleep, 1) \ | 104 V(Process_Sleep, 1) \ |
| 102 V(Process_Pid, 1) \ | 105 V(Process_Pid, 1) \ |
| 103 V(Process_SetSignalHandler, 1) \ | 106 V(Process_SetSignalHandler, 1) \ |
| 104 V(Process_ClearSignalHandler, 1) \ | 107 V(Process_ClearSignalHandler, 1) \ |
| 105 V(ProcessInfo_CurrentRSS, 0) \ | 108 V(ProcessInfo_CurrentRSS, 0) \ |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 struct NativeEntries* entry = &(IOEntries[i]); | 206 struct NativeEntries* entry = &(IOEntries[i]); |
| 204 if (reinterpret_cast<Dart_NativeFunction>(entry->function_) == nf) { | 207 if (reinterpret_cast<Dart_NativeFunction>(entry->function_) == nf) { |
| 205 return reinterpret_cast<const uint8_t*>(entry->name_); | 208 return reinterpret_cast<const uint8_t*>(entry->name_); |
| 206 } | 209 } |
| 207 } | 210 } |
| 208 return NULL; | 211 return NULL; |
| 209 } | 212 } |
| 210 | 213 |
| 211 } // namespace bin | 214 } // namespace bin |
| 212 } // namespace dart | 215 } // namespace dart |
| OLD | NEW |